【发布时间】:2013-02-07 19:58:08
【问题描述】:
(使用情节提要)
我试图让我的 ViewController 子类之一支持的不仅仅是纵向视图。
我已经加进去了
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationPortrait));
}
但它似乎没有做任何事情。我的 plist 支持除倒置之外的所有方向,并添加了 shouldautorotate 以仅允许在我想要的视图控制器中使用纵向。
【问题讨论】:
-
这是在iOS 6下吗?如果是这样,那么stackoverflow.com/questions/13923788/ios-6-rotation-not-working 之类的答案可能就是您想要的 - shouldAutorotate... 在 6 下已弃用,操作系统不再调用。
-
这是 ios6 的,是的。我尝试在要保持纵向的页面上将其更改为 shouldAutorotate {return NO} 的方法,但它们仍会旋转。不确定这是否是不正确的做法,但是,我转到 File 并创建一个新类,作为 ViewController.m/h 的子类,然后单击已拖入情节提要的视图控制器并更改将自定义类添加到 ident 中的新子类名称。检查员。我将 shouldAutorotate 添加到子类代码 main 中,但仍然没有任何效果。连接子类有什么我遗漏的吗?
-
可能不是,但正如我所说以及我链接到的答案详细说明,
shouldAutorotate...在 iOS 6 下不使用。所以你的类是否实现它没有区别。
标签: iphone ios xcode storyboard