Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6383509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:39:29+00:00 2026-05-25T02:39:29+00:00

I have a TabBarController set as main controller tab, where names were defined using

  • 0

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 could it be done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:39:31+00:00Added an answer on May 25, 2026 at 2:39 am

    Updated to XCode 8

    Since my original answer, a lot has happened: Swift 3, Storyboards, etc. Title is usually the one that all views share, and can be set in the attributes inspector

    Title Setup

    Also, for more control, you can always drag the UITabBarItem, and UINavigationItem elements from the designer view. You must drag them to the view that’s gonna be displayed in the tab bar/navigation controller. Basically they store the info as “I wanna be displayed in tab bar like this”.

    enter image description here

    Hello Scene is getting a TabBarItem added to it, so it can be configured.

    These two elements behave exactly as accessing the view controller’s .tabBarItem and .navigationItem properties via code. These properties always exist in code if they are child of the corresponding object (nav has navItem, and tab has tabItem), you don’t need to add them in storyboard/xib to have them.

    This last thing is kinda confusing, since in the storyboard/xib it appears you’re adding them to the view controller, but in truth you’re just saying “the nib will configure these properties too”.

    Original Answer

    The name that appears on the tab bar comes from the UIViewController‘s title property,

    self.title = @"Name me!";
    

    You can change the title at any point, and it should update the text appearing on the tab bar item. But be wary, do this as soon as possible, ideally, in the init method in use (or initWithNibName:bundle:, or initWithCoder:).

    The key here, is that the init methods are called as soon as the tab bar appears on screen, as it initialises all of its view controller. If you were to do it on viewDidLoad, that would only get called if you actually select the tab, then other family of calls, same goes for awakeFromNib, viewWillAppear:, viewDidAppear:, etc.

    The idea of having a title on the UIViewController, is to keep things consistent. If you show that viewController on a UINavigationController, the navigation bar on top should use the title property, as it does when using back. The UITabBarController also respects the same title property and changes accordingly.

    In terms of reusability, you should be setting the title only from the inside of the UIViewController subclass.

    The way of the Nib

    Using nibs or storyboards? If you have a UIViewController, you can give it the name straight up in the attributes inspector (or ⌥⌘4)

    Using interface builder, in the Attributes Inspector

    Unfortunately, if the File Owner is the UIViewController subclass, then you won’t be able to access it this way, simply because, XCode registers the File Owner as an “External Object”, and doesn’t show a configuration panel for it. 🙁

    Multiple titles, same view controller

    But sometimes, you just want to have them named differently

    // Modify the display title on the tab bar
    self.tabBarItem.title = @"World";
    
    // Modify the display title on the navigation bar
    self.navigationItem.title = @"Hello World";
    

    Screwing with the neighbours

    Each UIViewController should handle his own name, what if you want to force it from the outside (and thus, completely violating the original thing I said about reusability)?

    // Rename the other guy's .title property
    [[self.tabBarController.viewControllers objectAtIndex:<#Index#>] setTitle:@"Hello World"];
    
    // Or do as before, and rename the other guy's tab bar 
    [(UITabBarItem*)[self.tabBarController.tabBar.items objectAtIndex:<#index#>] setTitle:@"Hello World"];
    

    You could also probably do it with the navigation item, but that would require more gymnastics than I’m comfortable with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one tabbarcontroller set as main controller and its views were configured using
So I have a UIViewController (main application controller is a TabBarController). On this there
So I have a UITabView Controller that was created in interface builder. The title
I have a tab bar controller with different view controllers all using the same
I'm developing an iPhone application that have a TabBarController with two tabs. Each tab
I have a tabBarController xib. I've set the first item's class to a view
I have a UITabbarController set by the Interfacebuilder. The tabbarcontroller has 5 tabs, the
i have an app with tab bar and a navigation controller inside every tab.
Description I have a Tab Bar Controller with a navigation controller tab. The first
I have 2 tab bars in a tabbar controller, each with a nav controller.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.