My app asks the user via a UIActionSheet where they want to import an image from (Photo Library or Camera) and then launches the appropriate UIImagePickerController.
If the user selects Camera I want to first display a UIAlertView with a camera instructions image relevant to the app. This works, however the UIImagePickerController is launched while the alert is still on the screen and appears behind it. How can I launch the camera only once the user has dismissed the UIAlert?
-(void) actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex != [actionSheet cancelButtonIndex]) {
// User hasn't canceled, launch chosen photo source
NSString *selectedButtonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
if ([selectedButtonTitle isEqualToString:@"Camera"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"\n\n\n\n\n\n\n\n\n\n" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
UIImageView *cameraHelpView = [[UIImageView alloc] initWithFrame:CGRectMake(82, 46, 120, 160)];
UIImage *cameraTutorial = [UIImage imageNamed:@"cameraTutorial.png"];
cameraHelpView.image = cameraTutorial;
[alert addSubview:cameraHelpView];
[alert show];
[alert release];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController: picker animated: YES];
[picker release];
}