如何使用旋转动画在Landscape模式下呈现ViewController?

时间:2017-02-16 07:23:47

标签: ios objective-c iphone

我希望向横向模式呈现UIView并使用设备旋转变换动画将设备方向同时更改为横向。我怎么能这样做?

注意:我的应用是仅限纵向应用。

1 个答案:

答案 0 :(得分:0)

你必须设计你的第二个屏幕,自动布局启用大小类,并在viewWillAppear上使用以下代码

NSNumber *orientation = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];

[[UIDevice currentDevice] setValue:orientation forKey:@"orientation"];

您可以将导航控制器子类化为将横向模式约束为单视图控制器。