问题
I have a view controller, in which the navigation bar is transparent. My next view is a table view, in which the navigation bar is white.
To stop an unwanted animation carrying over, I am setting the navigation bar to transparent in the 'viewDidDissapear' of the table view. Unfortunately this leaves me with the image below when I navigate back (its even worse when you navigate forward). Does anyone know how to get rid of the black area?
-(void)viewWillDisappear:(BOOL)animated {
[self.navigationController.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
[super viewWillDisappear:NO];
}
This is the code I'm using in the table view controller.
回答1:
As you said, UNWANTED ANIMATIONS ,. i would suggest you to set (animated:NO) in both (presentViewController & dismissViewController) of your tableViewController……… and set your navigation bars in viewWillAppear of both controllers.. best and easy i think..
来源:https://stackoverflow.com/questions/19634448/how-to-remove-unwanted-black-area-during-navigation-bar-animation-screen-shots