导航栏闪现黑条问题

有时候需要隐藏导航栏,跳转的时候就容易出现黑条,出现黑条的原因是[self.navigationController setNavigationBarHidden:YES animated:animated];

[self.navigationController setNavigationBarHidden:NO animated:animated];

这个YES 和NO之间有间隔,所以会造成黑条的出现,解决办法是

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:animated];
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:self.navigationHidden(YES or NO) animated:animated];
}

Add a Comment

电子邮件地址不会被公开。 必填项已用*标注