Dmi*_*kin 13 iphone video objective-c uiimagepickercontroller ios
我们如何强制UIImagePickerController控制器仅以横向模式录制视频?
我知道这个类应该用于肖像录制,但我需要在横向上使用它.
找到了几个类似的问题,但没有任何解决方案适合我(iOS 6.1).
例如,观察设备方向对我不起作用(这个答案 - /sf/answers/150330911/)
如果我实现UIImagePickerController类,如下所示:
#import "UIImagePickerController+NonRotating.h"
@implementation UIImagePickerController (NonRotating)
- (BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
@end
Run Code Online (Sandbox Code Playgroud)
它几乎可以工作,但我在录制过程中看到一些控制和视频方向错误的奇怪行为(结果视频没问题).
1)开始.在正确的位置取消和录制按钮,但其他控制错误.视频旋转.

2)录音.定时器和视频都是错误的.
3)录制完成.都好!结果视频是对的.

你有什么想法?
更新 我需要在录制过程中以横向方向锁定屏幕.
试试这个也许会对你有帮助
- (BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
Run Code Online (Sandbox Code Playgroud)
它会起作用的...:)
| 归档时间: |
|
| 查看次数: |
4952 次 |
| 最近记录: |