{
return toInterfaceOrientation == UIInterfaceOrientationLandscapeRight ;
}
但是ios6.0之后就不支持了,不过要实现两个方法:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
//这里要注意的是不要用了UIInterfaceOrientationLandscapeRight,这个属性不支持,由于我的大意搞了很久才发现了
return UIInterfaceOrientationMaskLandscapeRight;
}
现在运行,屏幕就会向右旋转了..
Application windows are expected to have a root view controller at the end of application launch 运行项目的时候出现了这个提示:
解决办法是: self.window.rootViewController = navigation;
不能用 [self.window addSubview:navigation.view] 这个方法了.
本文介绍了如何在iOS 6.0及更高版本中进行屏幕旋转的适配,包括弃用的方法以及新的实现方式。通过实现shouldAutorotate和supportedInterfaceOrientations方法,可以成功设置应用的屏幕旋转方向。
1万+

被折叠的 条评论
为什么被折叠?



