Make app start and remain in landscape mode

五迷三道 提交于 2019-12-10 18:07:03

问题


How can I start my app in landscape mode, and keep the screen rotation that way?


回答1:


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
   interfaceOrientation == UIInterfaceOrientationLandscapeRight);
} 



回答2:


Implement the view controller's shouldAutorotateToInterfaceOrientation: method and return UIInterfaceOrientationIsLandscape(orientation);

Also set the Info.plist keys UIInterfaceOrientation and UISupportedInterfaceOrientations to UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight. UIInterfaceOrientation will take a single value so assign one of them and assign both of them to UISupportedInterfaceOrientations.



来源:https://stackoverflow.com/questions/6353076/make-app-start-and-remain-in-landscape-mode

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