【发布时间】:2011-08-10 09:15:56
【问题描述】:
我想根据某些条件旋转 ViewController。 shouldAutorotateToInterfaceOrientation 的问题是视图总是以纵向/横向方向开始(在 Interface Builder 中设置),用户必须旋转 ipad 才能使用正确的模式....我怎样才能改变这种行为? 谢谢。
【问题讨论】:
标签: iphone objective-c ipad rotation orientation
我想根据某些条件旋转 ViewController。 shouldAutorotateToInterfaceOrientation 的问题是视图总是以纵向/横向方向开始(在 Interface Builder 中设置),用户必须旋转 ipad 才能使用正确的模式....我怎样才能改变这种行为? 谢谢。
【问题讨论】:
标签: iphone objective-c ipad rotation orientation
对视图应用变换。
view.transform = CGAffineTransformMakeRotation(M_PI);
您可以使用 UIView 动画来为更改设置动画。
【讨论】:
您也可以尝试在 info.plist 中添加此内容:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
【讨论】:
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
这将在不旋转设备的情况下将方向更改为纵向模式。同样您可以使用 景观也
【讨论】: