How to set device (UI) orientation programmatically?

后端 未结 10 1520
感情败类
感情败类 2020-11-30 01:14

Would like everything on the screen (UI) to be able to rotate from landscape left to right or vica versa.

How do I go about doing this? Is this private?

I

10条回答
  •  北海茫月
    2020-11-30 01:46

    That method is called to determine whether your interface should automatically rotate to a given rotation (i.e letting UIKit do the hard work, rather than you doing it manually).

    So if you wanted your app to only work in landscape you'd implement the body of that method with:

    return UIInterfaceOrientationIsLandscape(interfaceOrientation);

    If you wanted your UI to auto rotate to all orientations you could just return YES;

    Is that what you were asking?

提交回复
热议问题