2012-03-07 81 views
0

我創建了一個tabbar應用程序。首先啓用了旋轉。該應用程序旋轉沒有任何困難。但爲了更好的使用,我評論了所有自動旋轉代碼,並在信息列表中刪除了除肖像之外的所有其他界面。但現在我需要它。我取消了所有代碼的註釋並添加了所有界面方向。但應用程序不旋轉。請爲我的英語不好Iphone Tabbar應用程序不旋轉

感謝任意一個幫助me.Sorry 拉克什

+1

請添加一些代碼 – Janub 2012-03-07 15:22:13

+1

如果tabBarController的任何viewController不允許旋轉,所有其他的將不會旋轉。像這樣的東西。 – 2012-03-07 15:28:21

+0

我應該給什麼代碼? – Kiron 2012-03-07 16:17:34

回答

1

添加到標籤欄控制器中的每個視圖控制器將有

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    return YES; 
} 

確保在他們每個人的回報是..

+0

是的,我做到了,但仍然沒有工作 – Kiron 2012-03-07 16:16:47

+0

對不起,夥計我得到它Shubhank謝謝你幫助我沒有把它給所有視圖控制器現在它解決了 – Kiron 2012-03-07 16:24:00

0
create a category like this and this method 
    @implementation UITabBarController(UITabBarControllerCategory) 

-(BOOL)shouldAutorotateToInterfaceOrientation: 
    (UIInterfaceOrientation)toInterfaceOrientation 
{ 
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication  sharedApplication]delegate]; 

    if ([AppDelegate isLandScapeOnly]){ 



     return NO; 
} 
    return YES; 
} 

@end