Iphone 如何将选项卡栏添加到uitableview
我的应用程序是导航基础应用程序。在此应用程序中,UIViewController具有按钮事件。点击按钮触发(pushViewController)CalendarTableview。现在我需要将Tabbar和tabitem添加到calendartableview。如何将Tabbar和tabitem添加到CalendarTableview。帮帮我 这是我的照片。Iphone 如何将选项卡栏添加到uitableview,iphone,uitableview,tabbarcontroller,Iphone,Uitableview,Tabbarcontroller,我的应用程序是导航基础应用程序。在此应用程序中,UIViewController具有按钮事件。点击按钮触发(pushViewController)CalendarTableview。现在我需要将Tabbar和tabitem添加到calendartableview。如何将Tabbar和tabitem添加到CalendarTableview。帮帮我 这是我的照片。 谢谢。在您的calendartableview\u控制器的viewDidLoad()方法中,尝试以编程方式创建选项卡栏,然后将其作为子视
谢谢。在您的calendartableview\u控制器的viewDidLoad()方法中,尝试以编程方式创建选项卡栏,然后将其作为子视图添加到calendartableview\u控制器的视图中:
//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]];
UINavigationController具有内置的导航工具栏。检查,如果我正确理解你的问题,那应该会有帮助。
@Rkm:结构完全取决于您。如您所见,如果希望一个viewController由选项卡栏控制,则vc必须是选项卡栏的子项之一。回到您的案例,您可能需要重新构建您的UI结构,以便这样的选项卡栏可以适合您的代码。我正在关注apple文档,但都说将选项卡栏修补到tabbarcontroller的主窗口,并将导航栏连接到tableview,我有点困惑。我没有得到,我张贴了我的照片,我不清楚。请告诉我,