0
我想在設備向右旋轉時禁用按鈕myButton。我設置了一個if塊來旋轉時隱藏按鈕,但設備無法識別它已被旋轉。當我運行模擬並旋轉模擬器時,我的NSLog語句顯示爲false。它爲什麼這樣做?Xcode方向屬性不返回當前方向
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
NSLog(orientation == [email protected]"true":@"false");
if([[UIDevice currentDevice] orientation] == UIInterfaceOrientationLandscapeLeft)
{
[myButton setHidden:YES];
}
所以我測試了我的觀點有:的NSLog(UIDeviceOrientationIsValidInterfaceOrientation([的UIDevice currentDevice] .orientation)@ 「真」:@ 「假」); 和我一直在僞造。什麼會導致無效的方向? – apples 2012-08-14 14:28:52