Xcode: how to build a landscape only iphone program

前端 未结 1 573
一向
一向 2021-01-14 12:40

in Xcode, I tried to design a landscape only user interface.

I both set UIViewController and UIView controls to landscape model. but when I placed the controls, like

1条回答
  •  礼貌的吻别
    2021-01-14 13:40

    In project plist setup Initial interface orientation field in Landscape (left home button). Also setup Supported interface orientations field.

    And override method -(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation in your ViewController:

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

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