【发布时间】: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