iOS導航欄顏色
阿新 • • 發佈:2018-12-19
-(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; //通過設定BackgroundImage來設定導航的背景 //設定背景為透明 [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImage new]]; } -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; //還原為系統預設 [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:nil]; }