我正在尝试使用此代码强制视图定向。
-(BOOL)shouldAutorotate
{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
发生的情况是模拟器中的视图以横向加载,当我将其转为纵向时,应用程序崩溃并出现此错误'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
。我想要发生的是,当你把它变成纵向时,它仍然是横向的并且不会崩溃。