2011-08-24 114 views

回答

1

您可以簡單地在UISplitViewController的viewControllers屬性的索引1更換VC。試試喜歡 -

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController 
{ 
    UIViewController* myReplacementVC = nil; 
     if(viewController == VC1) 
      myReplacementVC = myReplacementVC1; 
     else 
      myReplacementVC = myReplacementVC2; 

     NSMutableArray* arr = [[NSMutableArray alloc] initWithArray:splitVC.viewControllers]; 
      [arr replaceObjectAtIndex:1 withObject:myReplacementVC]; //index 1 corresponds to the detail VC 
      splitVC.viewControllers = arr; 
      [arr release]; 
    } 

HTH,

阿克沙伊

+0

我想你誤解了我的問題...我需要更改選項卡選擇時的詳細視圖.. – itdeeps

+0

沒有問題,只需要替換buttonPressed - tabBarController:didSelectViewController :.編輯我的代碼。 – Akshay

+0

你是對的,但只有問題發生..我沒有類的tabbarcontroller,因爲我創建分割視圖控制器,因此我不能實現tabbarcontroller委託方法...我是嗎?我在哪裏可以把這個行動? – itdeeps

相關問題