-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
-(BOOL)shouldAutorotate
{
return NO;
}
我只想在我的应用程序的一个视图中启用landascape方向。其他视图必须仅支持纵向模式。但对于iOS 6,它的自动旋转甚至我使用iOS 6的最新方法。期待正确的建议。
答案 0 :(得分:0)
对于仅限纵向方向,请尝试以下方法
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}
- (BOOL)shouldAutorotate {
return FALSE;
}