简体   繁体   中英

UIImagePickerControllerSourceTypeCamera problem with Navigation

I have an alert that asks user if he/she want a picture from Photo App or Camera ( UIImagePickerControllerSourceTypePhotoLibrary or UIImagePickerControllerSourceTypeCamera ).

When the user selects the image in both case, I push a view controller like that:

- (void)imagePickerController:(UIImagePickerController *)picker
    didFinishPickingMediaWithInfo:(NSDictionary *)info{       
        UIImage *pickedImage = [info
                                objectForKey:UIImagePickerControllerOriginalImage];

        PhotoViewController* controller = [[PhotoViewController alloc]initWithNibName:@"PhotoViewController" bundle:nil photo:pickedImage];
            [picker pushViewController:controller animated:YES];
    }

When users choose for UIImagePickerControllerSourceTypePhotoLibrary there is no problem, because my controller will be inside the UINavigatorController. So user can go back to previous Navigation.

But when users choose for UIImagePickerControllerSourceTypeCamera the UINavigation is not in the top of my view. I need it because I want to create a CANCEL button.

I use the same view in both case.

Do you have a suggestion for me, please? How could I see the UINavigation from the UIImagePicker in my PhotoViewController after user takes a picture?

Thanks a lot

I used this code in my PhotoViewControler to solve my problem:

- (void)viewDidLoad{
  ...
  ...
  [self.navigationController setNavigationBarHidden:NO animated:YES];
  ...
  ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM