自iOS6我有旋轉的大問題。我實現了所有新的旋轉方法(shouldAutorotate,preferredInterfaceOrientationForPresentation,supportedInterfaceOrientation),但所有視圖仍在旋轉。有趣的是 ,意見是保持他們的大小和其餘窗口(在景觀)是黑色的。ios 6應用程序正在旋轉,即使與shouldAutorotate:沒有
這就是我實施它的方式,有什麼不對嗎?
#pragma mark -
#pragma mark - InterfaceOrientation iOS 5
//Deprecated in iOS 6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark -
#pragma mark - InterfaceOrientation iOS 6
- (BOOL)shouldAutorotate{
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortraitUpsideDown;
}
感謝您的幫助。
最後一個不應該是'UIInterfaceOrientationMaskPortrait'嗎? –
它可以,如果它旋轉到兩個縱向方向,但它不應該旋轉到橫向方向 – Fry
只需嘗試更改應用程序的默認方向支持,即在plist文件中的'支持的接口方向'鍵下方,只選擇兩個支持的接口。這將解決你的問題:) –