Lucien Lucien - 3 months ago 35
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

UITabBarSystemItem
?

What i did :


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



So to change the title by default instead of "Featured" (because of
UITabBarSystemItemFeatured
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
UITabBarSystemItem
objects ?

I hope this is well enough explained :/

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

Answer

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

Source: iOS Development Documentation