强制 UIImagePickerController 以横向模式拍摄视频
我有一个主要是纵向的 iPhone 应用程序,需要拍摄一些视频,我想温和地鼓励(好吧,强制)用户以横向模式拍摄该视频。
我尝试创建一个 UIViewController
,并覆盖 ShouldAutorotateToInterfaceOrientation
以返回 false,并在其视图上创建适当的 CGAffineTransforms
,但它没有效果 - 我假设是因为一旦调用 PresentModalViewController
显示 UIImagePickerController
,视图就会超出图片。这些控件始终显示在同一位置,并且当我旋转手机时,切换到前置摄像头控件仍然会移动。
有什么建议吗?我愿意接受确凿的证据来证明这是不可能的,尽管我不确定我的老板会不会。
I've got a mostly-portrait iPhone application that needs to shoot some video, and I'd like to gently encourage (okay, force) users to shoot that video in landscape mode.
I've tried creating a UIViewController
with ShouldAutorotateToInterfaceOrientation
overridden to return false, and appropriate CGAffineTransforms
on its view, but it has no effect -- I assume because the view is out of the picture once you call PresentModalViewController
to display the UIImagePickerController
. The controls always show up in the same place, and the switch-to-front-camera control still moves around when I rotate the phone.
Any suggestions? I'd settle for definitive evidence that this isn't possible, though I'm not sure my boss would.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在 AppDelegate 中调用
UIDevice.CurrentDevice.BeginGenerateDeviceOrientationNotifications()
。然后在 UIImagePickerController 的 ViewDidLoad() 方法中,通过执行以下操作添加观察者:
其中 DeviceRotated 是
Try calling
UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications()
in your AppDelegate.Then in the ViewDidLoad() method of your UIImagePickerController, add an observer by doing the following:
where DeviceRotated is