Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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… :/

like image 202
Lucien Avatar asked Apr 25 '13 08:04

Lucien


1 Answers

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

Source: iOS Development Documentation

like image 177
Leon Lucardie Avatar answered Sep 30 '22 14:09

Leon Lucardie