2013-02-06 30 views
2

我有一個具有一些Tabitems的標籤欄控制器。一些tabitems是splitviewcontrollers。有時,當我改變方向時,splitview控制器的左側不能正確渲染,我在底部有一個黑色方塊。通過再次改變方向,問題就解決了。在iOS 6.1中更改方向時,SplitViewController的主方有時無法正確顯示

enter image description here

沒有什麼特別在我的代碼。在viewDidLoad中我有:

[self.navigationController setNavigationBarHidden:YES]; 
self.splitViewController.delegate = self; 

而且一個splitviewcontroller委託方法是平凡的處理:

- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController: (UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation 
{ 
return NO; 
} 

我沒有更多的,只是它的一些的tableview與細節方面的一些細胞。

回答

1

我已經看到了這樣的問題,我想出了唯一的解決方法是重新左側視圖控制器的視圖的大小,也它的導航控制器的視圖:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 
    if (self.splitViewController) { 
     viewHeight = ... 
     navViewHeight = ... 
     CGRect viewFrame = CGRectMake(0, 0, 320, viewHeight); 
     self.view.frame = viewFrame; 

     CGRect navControllerViewFrame = CGRectMake(0, 0, 320, navViewHeight); 
     self.navigationController.view.frame = navControllerViewFrame; 
    } 
} 

凡viewHeight和navViewHeight可以根據當前方向(當調用didRotateFromInterfaceOrientation時已經設置)從屏幕高度計算。我想這些值應該與你隱藏導航欄時相等。

相關問題