【发布时间】:2013-03-13 04:31:02
【问题描述】:
我们如何强制 UIImagePickerController 控制器只在横向模式下录制视频?
我知道这个类应该用于纵向录制,但我需要横向录制。
找到了几个类似的问题,但没有任何适合我的解决方案(iOS 6.1)。
例如,观察设备方向对我不起作用(这个答案-https://stackoverflow.com/a/2147584/775779)
如果我像下面这样实现 UIImagePickerController 类别:
#import "UIImagePickerController+NonRotating.h"
@implementation UIImagePickerController (NonRotating)
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
@end
它几乎可以工作,但我看到一些控件的一些奇怪行为和录制过程中错误的视频方向(结果视频正常)。
1) 开始。取消和录制按钮在正确的位置,但其他控件在错误的位置。视频是旋转的。
2) 录音。定时器和视频错误。
3) 录制完成。都好!结果视频是对的。
你有什么想法吗?
更新 我需要在录制过程中将屏幕锁定为横向。
【问题讨论】:
-
请不要关闭这个问题。您提供链接的问题没有正确答案,并且该 cmets 的所有解决方案都不起作用。
-
@iPatel 你读过我的问题吗?我已经告诉过这个链接。
-
您是否尝试过设置视频方向? stackoverflow.com/questions/14811641/…
-
@Gotschi 没有,没试过。我不使用 AVCaptureConnection,我使用 UIImagePickerController
-
您必须以某种方式旋转设备.... :(
标签: iphone ios objective-c video uiimagepickercontroller