我的大部分应用程序不支持轮换。在支持的方向上,我只选择了肖像。在应用程序使用的 UIViewController 子类上,我有这个:
-(BOOL)shouldAutorotate {
return NO;
}
-(NSUInteger)supportedInterfaceOrientations {
NSLog(@"supported?");
return UIInterfaceOrientationMaskPortrait;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
NSLog(@"preferred");
return UIInterfaceOrientationPortrait;
}
在支持方向的 UIViewController 子类中,我有这个:
-(BOOL)shouldAutorotate {
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
NSLog(@"supported?");
return UIInterfaceOrientationMaskAll;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
NSLog(@"preferred");
return UIInterfaceOrientationPortrait;
}
但是,我的应用程序不会在任何视图上旋转,包括这个。如何让它按照我的意愿在这里旋转?