How to restrict my app to landscape mode?

前端 未结 4 1400
不思量自难忘°
不思量自难忘° 2020-12-13 07:52

I have my iPad application created using the SplitView template. I wonder what is the best way to restrict my application to landscape mode?

I have tried overriding

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 08:03

    Try this (it works):

    -(BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)toInterfaceOrientation {
        if(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
            return YES;
        }
        else 
        {
            return NO;
        }
    }
    

提交回复
热议问题