【问题标题】:My app does not support Portrait mode but at times it turning into portrait mode我的应用不支持纵向模式,但有时它会变成纵向模式
【发布时间】:2013-12-12 03:17:54
【问题描述】:
我的应用不支持纵向模式,但有时它会变成纵向模式。我正在使用 Xcode 5.02 & 我在 iOS7 上运行我的应用程序。我在设置中取消选中了肖像模式,因此它不支持肖像,但是在某个时间点它变成了肖像,我没有任何线索,任何人都可以帮助我,我的应用程序是主从基础。应用程序委托和仪表板NavController 中的以下代码 sn-p 是 UINavigationController
self.window.rootViewController = self.dashboardNavController;
[self.window makeKeyAndVisible];
如果需要,我很乐意提供更多信息,提前致谢
【问题讨论】:
标签:
orientation
screen-orientation
uiinterfaceorientation
device-orientation
orientation-changes
【解决方案1】:
在 ViewDidLoad 中试试这个
CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI/2);
self.view.transform = transform;
// Repositions and resizes the view.
// If you need NavigationBar on top then set height appropriately
CGRect contentRect = CGRectMake(0, 0, self.view.size.height, self.view.size.width);
self.view.bounds = contentRect;