0
votes

Greetings! I have set my **UINavigationBar'**s barStyle to UIBarStyleBlack, and the tintColor to a color (other than black so as to get the color/gradient going). That much works well.

Now ... let's say I push a new view controller onto the nav controller stack. In this particular VC, I want the nav bar to turn black, but only within this VC.

So, in the new VC's viewWillAppear: method, I set the nav bar's tintColor to nil (or [UIColor blackColor] - either one works). In viewWillDisappear:, I change the tintColor back to what it originally was. Again, all is well.

Until I go back into the new VC a second (or additional) time. If I do that, the nav bar turns black again, but NOT the left bar button item! Instead, it keeps the original color from the parent VC!

I've looked at all manner of sample code (even Joe Hewitt's Three20 library, which appears to do the same thing mine does for its Photo controller/browser). As far as I can tell, I'm doing all the right things, but I'm stumped as to why the bar button item isn't being changed to black for all but the first time I enter my new VC.

Clues welcome/appreciated!

3

3 Answers

0
votes

From what I hear this is a known 3.0 bug.

0
votes

Try add to PARENT view controller:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", @"") style:UIBarButtonItemStylePlain target:nil action:nil];
    [self.navigationItem setBackBarButtonItem:backButton];
    [backButton release];
}
0
votes
    for (UIView *view in self.navigationController.navigationBar.subviews)
    {
        [view setNeedsDisplay];
    }

Hope it helps.