I'm trying to bring up a UIImagePickerController when my application opens, but it seems that I can't present it as a Modal View Controller without calling it as part of an Interface Builder Action.
The sample code from Apple, for example:
This will work perfectly when I tap on a button, but when I would put that code in a void method, such as:
It won't display the controller and will act as if nothing happened. I've even tried calling the IBAction methods programmatically and they won't work. Is there something I'm missing? Or is the only way to present a modal view controller through an Interface Builder action called by the interface?
The sample code from Apple, for example:
Code:
- (IBAction)showInfo {
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}
Code:
- (void)showInfo {
FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];
}