How to set device (UI) orientation programmatically?

后端 未结 10 1544
感情败类
感情败类 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:47

    Even though this is not an idle solution, works well for me.

    - (void)viewDidLoad
    {
       self.view.transform = CGAffineTransformIdentity;
       self.view.transform = CGAffineTransformMakeRotation((M_PI * (90) / 180.0)); 
       self.view.bounds = CGRectMake(0.0, 0.0, 480, 320);
    }
    

提交回复
热议问题