Supported orientations Crash iOS7

2019-09-18 07:22发布

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条回答
祖国的老花朵
2楼-- · 2019-09-18 08:07

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.

查看更多
登录 后发表回答