how do you make an app ONLY support landscape?

前端 未结 5 1937
长发绾君心
长发绾君心 2020-12-31 07:47

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

相关标签:
5条回答
  • 2020-12-31 07:56

    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.

    0 讨论(0)
  • 2020-12-31 08:03

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

    0 讨论(0)
  • 2020-12-31 08:04

    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.

    0 讨论(0)
  • 2020-12-31 08:07

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

    0 讨论(0)
  • 2020-12-31 08:17

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

    Picture showing how to change the supported orientations in the info.plist file

    0 讨论(0)
提交回复
热议问题