How can I display one UIView in landscape?

后端 未结 4 672
眼角桃花
眼角桃花 2020-12-13 11:08

I\'ve looked at every question so far and none seem to actually answer this question.

I created a UITabBarController and added several view controllers to it. Most

4条回答
  •  庸人自扰
    2020-12-13 11:59

    An post on a forum that might help. Short answer is you have to manually rotate your view or controller once the view has been drawn, in the viewWillAppear: method

    CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90));
    landscapeTransform = CGAffineTransformTranslate (landscapeTransform, +80.0, +100.0);
    
    [[appDelegate navController].view setTransform:landscapeTransform];
    

提交回复
热议问题