codes for "Hit to display an image"

Discussion in 'iOS Programming' started by zayjay, Jul 2, 2009.

  1. zayjay macrumors member


    Jul 24, 2008
    Hi, I'm a beginner for coding and what I'm trying to do is extremely simple:
    Hit the bottom to display an image, I know my codes will look stupid, but pls
    help me improving, thank you all in advance:

    #import "MainView.h"
    @implementation MainView;

    UIImage *sampleimage = [[UIImage imageNamed:mad:"box.jpg"] retain];
    pic = [[UIImageView alloc]init];
    pic.image = sampleimage;
    [sampleimage release];
    [pic release];

    [pic awakeFromNib];

  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    Four things:
    1) "Hit the bottom" of what?
    2) Why are you releasing pic?
    3) Don't call your method awakeFromNib. Could be confused with the UIKit method.
    4) Use the [ CODE ][ /CODE ] tags (removing the spaces) to enclose code snippets. These tags can be accessed via the # icon in the toolbar.

Share This Page