2012-09-24 40 views
1

更新 - 我想我想通了,但請閱讀我的問題,如果你想,並檢查我的解決方案(在答案中)是正確的,謝謝。我應該如何跟蹤更改masterViewController中的detailViewController?

我是新來的splitViewController,我很難理解如何彈出主控彈出時詳細視圖控制器。

這可能是我很難解釋,但我會盡我所能,這裏是一個截圖來了解我的故事板: enter image description here

的馬西德威是NavigationController具有的TableView的RootViewController的,當用戶選擇小區中的馬西德威推動下的tableview和其詳細情況如下所示編程方式更改:

在初始根:

detailViewController = (CCGViewController *)[[self.splitViewController.viewControllers lastObject] topViewController]; 

當一個細胞被點擊根

[detailViewController performSegueWithIdentifier:@"replaceSearchWithSponsor" sender:self]; 

這是工作,以深入,但是當我彈出母版視圖導航控制器我想成立彈出的詳細視圖的好方法其導航堆棧。

任何建議將不勝感激。

謝謝。

回答

0

我只是子類UINavigationController,當我彈出MasterNavigationController時,我也彈出了Detail。這似乎爲我工作,如果你看到任何潛在的問題,讓我知道:

在.H:

@interface CCGPopMasterNavigationController : UINavigationController 

@end 

在.M

@interface CCGPopMasterNavigationController() 

@end 

@implementation CCGPopMasterNavigationController 

- (UIViewController *)popViewControllerAnimated:(BOOL)animated { 
    [[[[self.splitViewController.viewControllers lastObject] topViewController]navigationController 
     ] popViewControllerAnimated:animated]; 
    return [super popViewControllerAnimated:animated]; 
} 
@end 
相關問題