how do you make an app ONLY support landscape?

╄→гoц情女王★ 提交于 2019-11-30 13:49:43

问题


how do you make an app ONLY support landscape? No portrait mode JUST landscape throughout the whole thing in xcode 3?


回答1:


My naive answer is to add this method in all of your root view controllers:

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

    return NO;
}

This is what I do in my game. Of course, my game only has one view controller.

Also, I found it helpful to set "Initial interface orientation" in my app's info.plist to Landscape.




回答2:


The accepted answer did not work for me. This did:

In the properties file for your app (YOURAPPNAME-Info.plist), located in the "supporting files" group, there is an array called "Supported interface orientations". Remove the orientations you don't want from the array, and your app will be locked into the remaining orientation.




回答3:


You can change the Supported interface orientations in your info.plist file, as shown below:




回答4:


Orientations are now easily set using the target's summary tab.




回答5:


We can change the orientation by simply selecting the required orientations as well. Select the device from "devices" and change the orientation



来源:https://stackoverflow.com/questions/5838459/how-do-you-make-an-app-only-support-landscape

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