将 UIImagePickerController 推到左侧

发布于 2024-08-15 21:44:42 字数 472 浏览 5 评论 0原文

我正在制作一个相机应用程序,它使用户可以访问照片库。他们触摸按钮,然后使用presentModalViewController弹出UIImagePickerControllerSourceTypeSavedPhotosAlbum。当他们触摸照片时,我想要一个视图将 ImagePicker 推到左侧,然后进入新视图。问题是,我想让 ImagePicker 保持打开状态,这样当他们返回时就不会出现延迟。这种情况发生在许多相机应用程序中,例如 NightCamera。每当我使用 [self.navigationController PushViewController:photoPreview]; 时,它会将视图推送到主视图,而不是选择器。当我使用 [picker.navigationController PushViewController:photoPreview]; 时,没有任何反应,因为选择器的 navigationController 为零。有人知道该怎么办吗?

I am making a camera app, which gives the user access to the Photo Library. They touch the button, and UIImagePickerControllerSourceTypeSavedPhotosAlbum pops up using presentModalViewController. When they touch a photo, I want a view to push the ImagePicker to the left and the new view to come in. The thing is, I want to keep the ImagePicker up, so when they go back to it there isn't a lag. This happens in many camera apps like NightCamera. Whenever I use [self.navigationController pushViewController:photoPreview];, it pushes the view to the main view, not the picker. When I use [picker.navigationController pushViewController:photoPreview];, nothing happens, because the picker's navigationController is nil. Does anyone know what to do?

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

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

发布评论

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

评论(2

花海 2024-08-22 21:44:42

是的,这是可能的。不存在“模态视图控制器”这样的东西,任何视图控制器都可以模态呈现。

由于 UIImagePickerController 已经是 UINavigationController,因此您可以直接在其上推送视图。因此,不要

[picker.navigationController pushViewController:some_view_controller];

只是

[picker pushViewController:some_view_controller];

删除 .navigationController

Yes it is possible. There is no such thing as "modal view controller", any view controller can be presented modaly.

Since UIImagePickerController is already a UINavigationController, you can push views directly on it. So instead of

[picker.navigationController pushViewController:some_view_controller];

just do

[picker pushViewController:some_view_controller];

removing .navigationController.

暗地喜欢 2024-08-22 21:44:42

试试这个:

if (!picker.navigationController)
    UINavigationController *navC = [[[UINavigationController alloc] initWithRootViewController:picker] autorelease];

[picker pushViewController:photoPreview];

Try this:

if (!picker.navigationController)
    UINavigationController *navC = [[[UINavigationController alloc] initWithRootViewController:picker] autorelease];

[picker pushViewController:photoPreview];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文