简体   繁体   中英

Objective-C, Refresh navigationBar in viewWillAppear

For some reason, when I use popViewControllerAnimated to return to a previous view, the tint of the UIBarButtonItem turns grey, rather than the desired purple color (which is set in the storyboard).

Is there a way to refresh the navigationBar within the viewWillAppear method? I've tried using [self.navigationController loadView]; , but that causes other issues and prevents the view from loading.

You could change it back programmatically.

-(void)viewWillAppear
{
UIColor *color = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
myNavController.navigationBar.tintColor = color;
}

Use http://www.rapidtables.com/web/color/RGB_Color.htm to find a color.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM