iPad 2 UIImagePickerController 相机自动旋转让我抓狂!
我已经尝试解决这个问题有一段时间了,但一无所获。
我正在 iPad 2 上使用相机 - 我的应用程序处于横向模式,但我想在纵向模式下使用相机。我似乎无法强制 ImagePicker a(进入纵向模式)和 b(停止自动旋转)。
有什么方法可以强制 ImagePicker 进入纵向(或横向),和/或停止它自动旋转?
即使应用程序处于横向状态并且设置为仅在横向方向返回“YES”,但 ImagePicker 会忽略这一点,并在您旋转 iPad 2 时旋转为纵向。
如果我可以强制它保持横向状态(尽管并不理想),我可以重新设计应用程序以在风景中使用相机,但我似乎甚至无法做到这一点!
非常感谢任何帮助!
I've been trying to sort this one out for a while and getting nowhere.
I'm using the camera on the iPad 2 - my application is in landscape, but I want to use the camera in portrait mode. I just can't seem to force the ImagePicker a, into Portrait mode, and b, to stop auto-rotating.
Is there any way that you can force the ImagePicker into portrait (or landscape), and/or to stop it auto-rotating?
Even though the App is in landscape and is set to return YES only to landscape orientations, the ImagePicker ignores that and rotates into portrait when you rotate the iPad 2.
If I could force it into staying in landscape then (although not ideal) I could re-design the app to use the camera in landscape, but I don't seem to be able to do even that!
Any help greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要重写的方法称为:
_isSupportedInterfaceOrientation:
所以它应该看起来像这样:
但它绝对是私有方法,因此Apple可能会拒绝您的应用程序
The method that you need to override called:
_isSupportedInterfaceOrientation:
So it should look something like this :
But it's definitely private method so Apple may reject your app
好吧,我找到了一种更方便的方法,并且没有使用私有代码的风险。
子类
UIImagePickerController
并在其 .m 文件中添加以下方法。Well i have found a more convenient way and has no risk of using private code.
Sub class a
UIImagePickerController
and add following method in its .m file.