0

My app works with tabbarcontroller as root view of the window, where on clicking each tab item loads splitviewcontroller with required views for it. The left and right panes of split views are navigation controllers. Now on any button action or didselectrow in tableview corresponding views are to be loaded in right pane. I succeeded loading views in right pane , but not able to display barbuttonitem when new view controller loaded in right pane of split view.

tabbarcontroller

-->splitviewcontroller

----->Leftpane:navigation controller

--------------->view controllers

----->Rightpane:navigation controller

--------------->view controller

Each Splitview of tab bar wil act like 'iPad Mail app' .

To make the app gernalised, I taken class RootiPadViewController which has the delegate of uisplitviewcontroller and uipopovercontroller which loads alls views in slpitview.

Loaded viewcontroller in right pane of split view as below.

UISplitViewController *splitViewController = (UISplitViewController*)[appDelegate.tabBarController.viewControllers objectAtIndex:tabIndex];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
//[navController pushViewController:viewController animated:YES];

NSMutableArray *array = [[NSMutableArray alloc] init];
[array addObject:[splitViewController.viewControllers objectAtIndex:0]];
[array addObject:navController];
splitViewController.viewControllers = array;
[array release];

Please suggest me why bar button item not displayed when views changed in splitviewcontroller.

App looks as belowenter image description here

enter image description here

4

3 回答 3

0

我可能是错的,但据我所知,条形按钮项应该仅在您处于纵向模式时出现,因为:

  • 拆分视图控制器有两个控制器(主视图控制器和详细视图控制器)
  • 当您处于横向模式时,两个视图控制器都会显示在屏幕上
  • 当您处于纵向模式时,仅显示详细视图控制器,因此会出现条形按钮项
  • 条形按钮项目目标是让您以纵向模式打开主视图控制器

请让我知道这是否对您有帮助。

于 2013-05-02T07:01:01.783 回答
0

请检查此示例项目https://github.com/alexth/TBSV

这是关于如何在 UITabBar 中使用 UISplitViewController。所有逻辑都在 Appdelegate 的-loadSplitToTab所有控制器的全部继承中,在其他所有情况下,UISplitViewController 都需要是根(如 Apple 文档中所述),并且您将无法在 UITabBar 中使用 UISplitViewController。

于 2013-05-08T12:29:58.113 回答
0

对于导航控制器,每个视图都应定义其左右栏按钮项,如果未定义任何内容,则选项卡栏将为空。您将获得的唯一 barbutton 项目是返回 barbutton 项目,当您将新的 View Controller 推到 navigationController 的 rootViewController 上方时,它会出现

您必须在 NavigationController 中每个 viewController 的 ViewDidLoad 方法中分配它们,并将它们设置为 parentViewController 的左右 barbutton 项(即 navigationController)

于 2013-05-02T07:30:40.993 回答