2013-10-24 37 views

回答

0

设备方向是真正的整数。你可以做的是有一个局部变量,当你点击按钮时你设置为当前的方向,然后从方向方法只返回那个方向。如果未设置该整数,则返回设备的方向。另请注意,iOS 6.0中已弃用shouldAutorotateToInterfaceOrientation。从文档:

shouldAutorotateToInterfaceOrientation : (Deprecated in iOS 6.0. Override the supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation methods instead.) 

编辑:这是UIInterfaceOrientation的参考。

的typedef枚举:NSInteger的{ UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft } UIInterfaceOrientation;