如何保持纵向模式的应用程序

我似乎无法保持我的应用程序在纵向模式,当我运行它时,我将支持的设备方向设置为只有肖像,它仍然旋转,所有帮助将不胜感激,谢谢!

把这个写到你所有的viewcontrollers:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } 

写在所有的视图控制器

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return NO; } 

也在project-info.plist中

更改密钥的值

 <key>UISupportedInterfaceOrientationss</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> 

 <key>UISupportedInterfaceOrientationss</key> <array> <string>UIInterfaceOrientationPortrait</string> </array>