iphonenavigationbaruibarbuttonitemstyle

UIBarButtonItem on navigation bar with UIBarButtonItemStyleDone style doesn't show in blue color


I have a done button on navigation bar, I want to have it shown as blue. But just doing the following seems doesn't help. What am I missing here? I know that if the navigation bar is in black color, the button will be shown as blue automatically, but I don't want the color of the navigation bar on this view controller to be black.

- (UIBarButtonItem *)doneButton {
    UIBarButtonItem *doneButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done" 
                                                                    style:UIBarButtonItemStyleDone 
                                                                   target:self 
                                                                   action:@selector(done:)] autorelease];

    return doneButton;
}

Solution

  • Changing combination of NavigationBar and BarItems appearance is not easy tasks before iOS5.

    Standard way is to subclass NavigationBar. This nice sample code may help, even if not directly.

    In iOS5, you can use "appearance proxy". Nice tutorial is here