如何添加的TabBar到的UITableView

问题描述:

我的应用是导航的基础application.In这种应用中,具有的UIViewController按钮事件。点击按钮触发到(pushViewController)CalendarTableview。现在我需要将Tabbar和tabitem添加到calendartableview。如何将Tabbar和tabitem添加到CalendarTableview。帮我 。如何添加的TabBar到的UITableView

这里是我的照片。 alt text 谢谢。

UINavigationController的有内置的导航工具栏。检查the section in appples developer documentation,这应该有助于我理解你的问题的权利。 views

在你calendartableview_controller的viewDidLoad中()方法,尝试以编程方式创建一个标签栏,然后将它作为一个子视图添加到您的calendartableview_controller的视图

//create a tab bar controller in your calendartableview_controller 
    UITabBarController *tabBarController = [[UITabBarController alloc] init]; 
    tabBarController.title = @"My Tab Bar"; 

    //assign child controllers to the tab bar controller 
    tabBarController.viewControllers = [NSArray arrayWithObjects:firstViewController, secondViewController, thirdViewController, nil]; 

    //add it to your calendartableview_controller's view as a subview 
    [self.view addSubview:[tabBarController view]]; 
+0

@Rkm:结构完全取决于你。正如你所看到的,如果你想让一个viewController由标签栏控制**,该vc就是标签栏的子项之一。回到您的案例,您可能需要重新构建您的UI结构,以便这样的标签栏可以放入您的代码中。 – 2011-01-06 14:52:08

+0

我正在关注苹果文档,但都说,达拉格tabbarcontrolbar的主窗口,并将导航栏连接到tableview,我有点混乱。我没有得到,我张贴了我的照片,我不清楚。请告诉, – SOF 2011-01-06 14:59:19