Question

I just can`t put any title on navigationItem.

self.navigationItem.title = @"My Account";

I don`t see any deprecation warning, anyone knows something about it?

THanks,

Was it helpful?

Solution

Found a way:

[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     [UIColor whiteColor],UITextAttributeTextColor,
                                                                     [UIColor whiteColor], UITextAttributeTextShadowColor,
                                                                     [UIFont fontWithName:@"HelveticaNeue-Bold" size:16.0], UITextAttributeFont, nil]];
    self.navigationItem.title = @"My Account";

You need to set TextAttributes or won't work.

OTHER TIPS

Updated answer to replace deprecated properties.

[self.navigationController.navigationBar 
    setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
    [UIColor whiteColor],NSForegroundColorAttributeName,
    [UIColor whiteColor], NSShadowAttributeName,
    [UIFont fontWithName:@"HelveticaNeue-Bold" size:16.0], NSFontAttributeName, nil]];

do

self.navigationController.navigationItem.title = @"My Account";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top