iOS-导航背景设置

-(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];

}

你可能感兴趣的:(iOS-导航背景设置)