Return to Snippet

Revision: 15859
at July 20, 2009 02:39 by arpit


Initial Code
- (void)viewDidLoad {
contentView = [[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentView setImage:[UIImage imageNamed:@"284.jpg"]];
[contentView setUserInteractionEnabled:YES];
self.view = contentView;
[contentView release];
UIButton *startButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 180.0f, 130.0f)];
[startButton setBackgroundImage:[[UIImage imageNamed:@"squareButton.png"] stretchableImageWithLeftCapWidth:110.0 topCapHeight:0.0] forState:UIControlStateNormal];
[startButton setCenter:CGPointMake(195.0f, 208.0f)];
[startButton addTarget:self action:@selector(playSound:) forControlEvents:UIControlEventTouchUpInside];
[contentView addSubview:startButton];
[super viewDidLoad];
}

Initial URL
http://pointlessprogrammers.com/?p=100

Initial Description


Initial Title
Add a button with background image

Initial Tags
iphone

Initial Language
Objective C