xcode navigation title write programmatically

self.navigationItem.title = @"My Title";
self.title = @"JAJAJ";

I used this codes but not work. Most of time i use this code and was work. But now not work any idea ?

Upvotes: 0

Views: 85

Answers (1)

anneblue
anneblue

Reputation: 706

Write either

self.title = @"JAJAJ";

in your init method of your view controller (not in viewDidLoad),

or override:

- (UINavigationItem*) navigationItem
{
    UINavigationItem* item = [super navigationItem];
    item.title = @"MY Title";
    return item;
}

both works.

For explanation, see Apple's Documentation on navigationItem

Upvotes: 1

Related Questions