回答
只需檢查視圖控制器的自動調整大小的屬性。
(固定語法錯誤)
- (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