Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access navigation controller back button

In a detail view of my app, the navigation controller's back button seems to be taking cues for its color from some ungodly manifestation. Via one path to the detail view, it's blue; via another, it's black. In either case, the back button doesn't seem to exist within the self.navigationController object.

So here's a detail view:

detail view of my app

And here's a snapshot of the navigation controller at this point:

enter image description here

I'm pretty sure I know how to change the color of this particular element, but I don't know where to find it. Ideas?

VenueTableViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *show;

    if( [self.listType isEqualToString:@"showsByRegion"] )
    {
        NSString *venueIndex = [[self.allShows allKeys] objectAtIndex:[indexPath indexAtPosition:0]];
        int index = [indexPath indexAtPosition:1];
        show = [[self.allShows objectForKey:venueIndex] objectAtIndex:index];
    } else {
        int index = [indexPath indexAtPosition:(indexPath.length - 1)];
        show = [self.showsAtVenue objectAtIndex:index];
    }

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
                                                         bundle:[NSBundle mainBundle]];

    detailViewController = [storyboard instantiateViewControllerWithIdentifier:@"InfoViewController"];

    detailViewController.showInfo = show;

    // Pass the selected object to the new view controller.
    [self.navigationController pushViewController:detailViewController animated:YES];

}

InfoViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.tableView = [[self.view subviews] objectAtIndex:1];

    [self createInfoViewDictionary];
    [self addTopImage];
    [self setFrameForTableView];
    [self bindLabelsToProperties];

    [self.navigationController.navigationBar setTitleTextAttributes:[SHColors sharedInstance].navBarText];
}
like image 919
dclowd9901 Avatar asked Apr 06 '26 07:04

dclowd9901


1 Answers

If you are getting different colors is because you are getting there from different viewcontrollers and those viewcontrollers have different tintColor.

Then, you need to set the color you want using:

- (void)viewDidLoad
{
    ....
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    ....
}

If you are thinking in have the same color for all the navigation bar, you can use UIAppearance proxy to set them in AppDelegate (editted: as Jordan Montel said)

like image 78
Alex Avatar answered Apr 08 '26 19:04

Alex