How to hide the title on the tab bar item with navigation controller

SALEH picture SALEH · Apr 12, 2016 · Viewed 10.5k times · Source

I have a tab bar item on navigation controller connected with tab bar controller and i want to delete the title in swift

Tab Bar Controller > Navigation Controller > View Controller

Tab Bar Item

Flow of the program

The application start with the tab bar controller with five tabs each one of these tabs are working fine i mean as hiding the title under the tab bar item but the tab in the image only have the problem of not been hidden and for that the application is also working on this tab okay if the user is logged out and the Viewcontroller in the image is showing but if the user is sign in the title on the tab bar item is showing so if there is away that i can hide the title programmatically

Answer

Peter picture Peter · Aug 18, 2017

As others have suggested, you can either go to Interface Builder and erase the Title on the Bar Item or you can do it programatically.

This is enough as long as you don't set the title property for the UIViewController that your tab links to. If you want to set a title for your view controller and avoid it showing up as the bar item title, use navigationItem.title = "My Title" instead of title = "My Title".