如何以编程方式重新排序TabBar的选项卡?

时间:2013-03-15 17:57:52

标签: ios xcode tabbar

有没有办法在xCode上以编程方式重新排序TabBar的标签?

非常感谢,Matteo!

1 个答案:

答案 0 :(得分:1)

试试这个:

- (void)applicationDidFinishLaunching:(UIApplication *)application {

   tabBarController = [[UITabBarController alloc] init];

   MyViewController* vc1 = [[MyViewController alloc] init];
   MyOtherViewController* vc2 = [[MyOtherViewController alloc] init];

   NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
   tabBarController.viewControllers = controllers;

  // Add the tab bar controller's current view as a subview of the window
  [window addSubview:tabBarController.view];
 }