Locking Interface Orientation?

六月ゝ 毕业季﹏ 提交于 2019-12-25 00:14:31

问题


On the initial view of my app I want the interface to be portrait only but on the view controllers after that it can be any orientation. I tried this code to lock it but it doesn't work and the view can still rotate:

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

回答1:


The reason that code is not working is most likely because you are running iOS 6. Try this code instead:

- (BOOL)shouldAutorotate {
    return NO;
}


来源:https://stackoverflow.com/questions/12994990/locking-interface-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!