Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

zayjay

macrumors member
Original poster
Jul 24, 2008
42
3
Hangzhou
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;

-(void)awakeFromNib;
{
UIImage *sampleimage = [[UIImage imageNamed:mad:"box.jpg"] retain];
pic = [[UIImageView alloc]init];
pic.image = sampleimage;
[sampleimage release];
[pic release];

-(IBAction)hit;
{
[pic awakeFromNib];
}

@end
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.