Change tab name in uitabbarcontroller

前端 未结 7 2211
离开以前
离开以前 2020-12-28 13:57

I have a TabBarController set as main controller tab, where names were defined using interface builder. Now I would like to change its names programmatically.

How c

7条回答
  •  無奈伤痛
    2020-12-28 15:01

    You probably want to do this in UITabBarController::viewDidLoad in which case you need to set the view controller's title because the tab bar items are currently 0 at that point. So use

    [[self.viewControllers objectAtIndex:0] setTitle: @"Buga"];
    [[self.viewControllers objectAtIndex:1] setTitle: @"Nuga"];
    

提交回复
热议问题