How to set tab bar item title programmatically in objective c?

前端 未结 10 1508
猫巷女王i
猫巷女王i 2021-01-31 15:46

I want to set title to tab item programatically, but it not works. My code is below:

- (IBAction)tab1Click:(id)sender {
    myTabBarController = [[UITabBarContro         


        
10条回答
  •  忘了有多久
    2021-01-31 16:10

    How I do it in the actual View Controller (not the App Delegate):

    // set tab title
    self.title = @"Tab Title";
    // optionally, set different title for navigation controller
    self.navigationItem.title = @"Nav Title";
    // Note: self.title will reset Nav Title. Use it first if you want different titles
    

提交回复
热议问题