2013-10-24 116 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;