how do you make an app ONLY support landscape?

前端 未结 5 1959
长发绾君心
长发绾君心 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.

提交回复
热议问题