当我的应用程序在iPhone上启动时,它会以纵向显示,应该如此 . 当它以iPhone模式在iPad上启动时,如果以这种方式旋转,它将以横向显示 . 这是我的代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(BOOL)shouldAutorotate {
return NO;
}
3 回答
在项目info.plist文件中,从支持的方向列表中删除格局标志 .
对于iOS 6,请尝试:
在Xcode中选择一个目标,然后在摘要选项卡下确保您只选择了UIpotrait方向并且所有这些方向都未被选中,然后选择信息选项卡,并在“支持的界面方向”行下看到它应该只有UIpotrait方向 . 现在打开你的委托文件和ios5这个方法有效
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); }
但是iOS6不推荐使用此方法来覆盖iOS6
}
} - (NSUInteger)应用程序:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
}
}