【问题标题】:UIImagePickerController interfaceOrientation always come up as portritUIImagePickerController interfaceOrientation 总是以纵向出现
【发布时间】:2013-08-09 03:10:12
【问题描述】:

我正在尝试捕获正在呈现的 UIImagePickerController 的当前方向,并相应地更改覆盖视图的 hidden 属性。

if([notification.name isEqualToString:@"UIDeviceOrientationDidChangeNotification"]) {
        UIInterfaceOrientation orientation = self.cameraImagePicker.interfaceOrientation;
        if(orientation == UIInterfaceOrientationPortrait) {
            self.cameraImagePicker.cameraOverlayView.hidden = NO;
        } else {
            self.cameraImagePicker.cameraOverlayView.hidden = YES;
        }
    }

但是orientation == UIInterfaceOrientationPortrait即使我旋转相机,但每次设备旋转时都会调用这个方法。

注意:根据项目文件,我的应用程序仅支持纵向,但 UIImagePickerController 仍然支持旋转

对于这个问题的任何帮助将不胜感激!

【问题讨论】:

    标签: iphone ios objective-c


    【解决方案1】:

    iOS6 之后,苹果改变了orientation API。你可以在你的appdelegate中试试这个方法,希望对你有帮助。

    - (NSUInteger)application:(UIApplication *)application  supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
        return UIInterfaceOrientationMaskPortrait;
    }
    

    【讨论】:

      猜你喜欢
      • 2013-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-06
      • 2013-05-22
      • 1970-01-01
      • 2012-03-07
      相关资源
      最近更新 更多