回答
只需检查视图控制器的自动调整大小的属性。
(固定语法错误)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
return NO;
}
如果你想只需在应用程序的Info.plist文件停止整个应用程序旋转再改支持的接口方向,初始界面取向财产为纵向或横向依赖on你
我强烈建议不要在iPad上停止旋转,因为支持旋转是iPad上必须的。这是因为iPad不像通常以纵向视图(AKA Vertical)保存的iPhone那样采用正常的方式。因此,您必须将选择留给用户以最终锁定方向
HIG实际上并未将此作为要求声明,但作为建议,但有许多应用程序被此问题拒绝。
通过,如果你想这对于限制数视图控制器应实现方式:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationPortrait){
return YES;
}
}
在iOS6的shouldAutorotateToInterfaceOrientation
已被弃用。改为覆盖supportedInterfaceOrientations
和preferredInterfaceOrientationForPresentation
。
您的[请参阅](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/DeprecationAppendix/AppendixApresentedApirecatedAPI.html#//apple_ref/occ/instm/ UIViewController/shouldAutorotateToInterfaceOrientation%3a)链接不再有效 – dumbledad 2016-02-22 11:54:37
全球可控旋转锁定的主要思想是写包含锁定机构对每个视图控制器的UIViewController类别。
你只需要修改supportedInterfaceOrientations
方法进行了全局
- (NSUInteger)supportedInterfaceOrientations
{
return __orientation;
}
这里__orientation
是可以通过类的方法来设置静态变量。
完全实现的类别呈现here
请更新您的projectname.plist这样。支持的接口方向只有一个对象“肖像(下home键)”
- 1. 如何停止mainView旋转?
- 2. PanoramaGL如何停止旋转
- 3. 如何停止状态条在ios 7中旋转视图时重叠
- 4. iOS 9.0.2是否停止自动旋转?
- 5. 停止旋转youtubevideo播放器ios sdk
- 6. 动画旋转视图IOS
- 7. iPhone:防止旋转视图
- 8. 屏幕旋转停止视频传输
- 9. 开始/停止图像视图旋转动画
- 10. 停止UITabBarController旋转但UIViewController旋转
- 11. jQuery的旋转:停止旋转不息
- 12. iPhone:如何防止从景观视图旋转视图?
- 13. 如何停止css/jquery旋转
- 14. SpriteKit:如何停止/重置旋转physicsBody
- 15. 如何停止jQuery旋转动画?
- 16. 如何用cancelAnimationFrame停止旋转?
- 17. 如何在`willRotateToInterfaceOrientation停止旋转:`
- 18. 铯WebGL相机旋转,如何停止旋转
- 19. 如何在其他零件旋转时停止旋转物体?
- 20. 360度后停止图像旋转
- 21. 如何在完成所有旋转后停止旋转html图像?
- 22. 在MouseOver中旋转缩略图并停止在Mouseleave中旋转
- 23. 如何防止iOS 6中的全屏视频旋转
- 24. 在方向切换视图时停止状态栏旋转
- 25. 停止JavaScript div旋转
- 26. 让旋转木马停止
- 27. Surfacelistbox拖放(停止旋转!?)
- 28. Android ProgressDialog停止旋转
- 29. 停止旋转和移动
- 30. iOS在某些视图中阻止旋转
这很容易和有用。有没有办法在一个视图控制器中覆盖它?我有10个视图控制器,其中一个需要在横向上,但其余的我用这种方法只限于纵向。 – PeonProgrammer 2015-02-27 18:13:06
如果是这种情况,您必须重写方法 - (NSUInteger)supportedInterfaceOrientations { return __orientation; }在所有视图中控制器 – iOSPawan 2015-03-10 03:55:05