[英]iPhone 3.x and 4.x: shouldAutorotateToInterfaceOrientation is returning TRUE, but nothing happens
[英]shouldAutorotateToInterfaceOrientation but nothing happens
我們的應用程序被拒絕,因為應用程序不會顛倒旋轉。
所以我們有一個tabbar App,將此代碼添加到所有標簽...
shouldAutorotateToInterfaceOrientation
沒有意義,將此代碼添加到Appdelegate沒有幫助,我們做錯了什么?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
UITabbarcontroller是UIViewcontroller的子類。 要解決您的問題,只需為您創建子類或為您添加類別UITabbarcontroller實現:
@interface UITabBarController (rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end
@implementation UITabBarController (rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
@end
如果您想使標簽欄僅旋轉為縱向和顛倒,請使用以下代碼
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
確保每個 UIViewController
實現
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.