Man*_*ish 3 landscape uiimagepickercontroller uiinterfaceorientation ios6
我正在开发一个仅支持横向定位的应用程序.它使用a UIImagePickerController从库中选择图像和/或视频.应用程序在iOS-5或之前运行良好但在我尝试呈现图像选择器控制器时它会崩溃.它在崩溃后给出以下消息:
*由于未捕获的异常'UIApplicationInvalidInterfaceOrientation'终止应用程序,原因:'支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES'
正如@rocky所说,你必须在你的应用程序中添加Potrait模式才能使用UIImagePickerController像这样
或者将此添加到您的仅景观应用委托类
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)
从Mr.Daniel的回答:我发现你的风景唯一的应用程序一个很好的解决方案,因为你需要为仅支持横向到应用程序,你只需要添加一个类别UINavigationController像这样
@implementation UINavigationController (LandscapeOnly)
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
@end
Run Code Online (Sandbox Code Playgroud)
并将其添加到您的viewControllers,它适用于我.
| 归档时间: |
|
| 查看次数: |
4368 次 |
| 最近记录: |