Supported orientations Crash iOS7

我怕爱的太早我们不能终老 提交于 2019-12-11 22:13:55

问题


I have portrait only app which do video capturing and some other tasks! everything is working fine, I want to keep app in portrait, but Camera view in landscape only. I have rotated single view test in portrait app by using UIInterfaceOrientationMask but Rotating Camera view caused the Following Crash:

Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

for further info I m using following line to insert show camera. I insert camera view only when app is in landscape. I use following line of code to show camera!

[self.view insertSubview:imagePicker.view atIndex:0];

any solution/suggestion please?


回答1:


First change your orientation settings to support landscape and portrait. Create a UINavigationController category and add this lines. (I assume that your center view controller is a navigation controller)

- (BOOL)shouldAutorotate {

    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait;
}

and present your image picker.

Edit: In iOS7 this method is not working. I guess the only proper way is creating a layer for camera controls and subclass uiimagepickerview to support landscape only.



来源:https://stackoverflow.com/questions/23005351/supported-orientations-crash-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!