Lucien Lucien - 1 year ago 177
iOS Question

How to set title with UITabbarsystemitem

I just wanted to know how i can set a title of a tab bar item using


What i did :

self.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0];

So to change the title by default instead of "Featured" (because of
object), I wrote :

self.tabBarItem.title = @"Actu";

So in my mind i should have "Actu" as title instead of "Featured".

But it changes nothing, the title keeps being "Featured" (default title).

I also tried :

[[self.tabBarController.tabBar.items objectAtIndex:0] setTitle:NSLocalizedString(@"Actu", @"Actu")];

(because this tabbaritem is at index 0), but nothing changes.

Or maybe such a modification is not possible using
objects ?

I hope this is well enough explained :/

PS : Sorry for my english and anything else wrong, 1st post ever… :/

Answer Source

When a UITabBarItem is initalized using initWithTabBarSystemItem:tag: you cannot change the image or title properties later on.

Source: iOS Development Documentation

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download