Change font of back button on UINavigationController

back-button, fonts, objective-c, uibarbuttonitem, uinavigationcontroller

Solution

Use this instead, default function available in iOS 5:

UIBarButtonItem *backbutton = [[UIBarButtonItem alloc] initWithTitle:@"back" style:UIBarButtonItemStyleBordered target:nil action:nil];

[backbutton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
    [UIColor blackColor],UITextAttributeTextColor,
    [UIFont fontWithName:TEXTFONT size:16.0f],UITextAttributeFont,nil]
    forState:UIControlStateNormal]; 

Problem

I'm trying to change the font color of the text on my back button in my `UINavigationControllerBar`: ``` [[UIBarButtonItem appearance] setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; ``` I get this error: ``` [_UIBarItemAppearance setTitleColor:forState:]: unrecognized selector sent to instance 0x69aeb70' ```

Original source

Related problems