UIImagePickerControllerSourceTypeCamera 导航问题

发布于 2024-11-27 14:16:08 字数 1030 浏览 1 评论 0原文

我有一个警报,询问用户是否想要来自照片应用程序或相机的图片(UIImagePickerControllerSourceTypePhotoLibraryUIImagePickerControllerSourceTypeCamera)。

当用户在这两种情况下选择图像时,我会像这样推送一个视图控制器:

- (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];
    }

当用户选择 UIImagePickerControllerSourceTypePhotoLibrary 时,没有问题,因为我的控制器将位于 UINavigatorController 内部。因此用户可以返回到之前的导航。

但是,当用户选择 UIImagePickerControllerSourceTypeCamera 时,UINavigation 不在我的视图顶部。我需要它,因为我想创建一个取消按钮。

我在这两种情况下使用相同的视图。

请问您对我有什么建议吗?用户拍照后,如何从 PhotoViewController 中的 UIImagePicker 看到 UINavigation?

多谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱殇璃 2024-12-04 14:16:08

我在 PhotoViewControler 中使用此代码来解决我的问题:

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

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

- (void)viewDidLoad{
  ...
  ...
  [self.navigationController setNavigationBarHidden:NO animated:YES];
  ...
  ...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文