1递览、當前界面的viewWillAppear:(BOOL)animated寫上以下代碼
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//設置導航欄透明
[self.navigationController.navigationBar setTranslucent:true];
//把背景設為空
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
//處理導航欄有條線的問題
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
}
2、當前界面即將消失時疯溺,還原導航欄哥牍,避免看不到主題顏色
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.navigationController.navigationBar setTranslucent:false];
self.navigationController.navigationBar.barTintColor = YHStringColor(@"#6E98C2");
}
到此,結束喝检!