0

When I change controller's self.title, tab title also changes to that string.

Is it any workaround to avoid it?

Shmidt
  • 16,436
  • 18
  • 88
  • 136

1 Answers1

0

From the documentation of UITabBarController:

If you do not provide a custom tab bar item for your view controller, the view controller creates a default item containing no image and the text from the view controller’s title property.

So you can either instantiate your own UITabBarItem and assign it to the view controller’s tabBarItem property.

Or simply just add a new property to your UIViewController that can store the string:

@property (nonatomic, copy) NSString *myTitle;

And then use that property instead: self.myTitle = @"Your title here";

hwaxxer
  • 3,363
  • 1
  • 22
  • 39
  • I didn't understand about property, that can store string? Can you please clarify? – Shmidt Dec 08 '12 at 11:04
  • OK, now I see... But I want to modify title a few times, so property isn't really a good solution – Shmidt Dec 08 '12 at 11:20
  • A property is just an automatic way to generate (synthesize) getters and setters for an instance variable. You can modify the property as much as you like. – hwaxxer Dec 08 '12 at 20:05