Ok I have been at this for a few hours now and it is starting to bug me a little bit, I am trying to create a UIButton with a UIImage associated to it, here's what I got. After I build and go, I see the button is there, but no image...any ideas? I have dropped the image into the project, so it's there
- (void)loadView {
// create an instance of UIView
UIView *myView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[myView setAutoresizingMask:UIViewAutoresizingFlexibleHeig ht|UIViewAutoresizingFlexibleWidth];
// set the background color of the view to black
myView.backgroundColor = [UIColor whiteColor];
// create a frame for the button to go in
CGRect frame = CGRectMake(30, 100, 260, 80);
// create a button
UIButton *snap_picture_button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
// set the frame of the button
snap_picture_button.frame = frame;
// create an image for the button
UIImage *snap_picture = [UIImage imageWithContentsOfFile:@"snap_photo.jpg"];
// set the image for the button
[snap_picture_button setBackgroundImage:snap_picture forState:UIControlStateNormal];
// enable the button
snap_picture_button.userInteractionEnabled = YES;
// add the button to the view
[snap_picture_button addTarget:myView
action:@selector(snapPhoto
forControlEvents:UIControlEventTouchUpInside];
// add the button to the view
[myView addSubview:snap_picture_button];
// add myView to the viewController
self.view = myView;
[myView release];
}