How can I modify the title and the icon of items of TabBarController? It is possible directly in Interface Builder?
Modify title and icon of a uitabbarcontroller item
Asked Answered
Yes, you can do it programetically as well directly from IB too.I suggest you to start a New Project of type Tabbed Application in XCode. You'll get your answer. –
Fineable
I have already a TabBarController, and when i add a segue, i can see a tab bar item created but i can't select it –
Pianist
i'm trying to do that in IB, i don't have code –
Pianist
in code:
UITabBarItem *tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Fancy Tab" image:[UIImage imageNamed:@"FancyTab"] tag:1];
myViewController.tabBarItem = tabBarItem; // to set the tabBarItem from outside the viewController
self.tabBarItem = tabBarItem; // to set the tabBarItem from inside the viewController
in regular .xib: click the item in the tabBarController. And then click it again. You can now edit title and icon in the attribute inspector.
in storyboard: click the item in the viewController that is connected to the tabBarController (not in the tabBarController itself). This time one click is enough. And set title and icon in the attribute inspector.
I use storyboard, and the problem is that i can see in IB when i add a segue, but in the left in IB, there is no items created under the tabBar –
Pianist
did you add the correct segue? It has to be "Relationship - View Controllers" –
Singhal
strange. So your storyboard doesn't look like the one in my screenshot? Did you change "Simulated Metrics" - "Bottom Bar" of the view controller in the attributes panel? –
Singhal
I was trying to edit the item in the TabBarController, thanks a lot –
Pianist
© 2022 - 2024 — McMap. All rights reserved.