导航控制器全透明


OC

- (void)viewWillDisappear:(BOOL)animated{    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];    [self.navigationController.navigationBar setShadowImage:nil];}

-(void)viewWillAppear:(BOOL)animated{    [super viewWillAppear:animated];    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];    [self.navigationController.navigationBar setShadowImage:[UIImage new]];}

Swift

override func viewWillAppear(_ animated: Bool) {        self.navigationController?.navigationBar .setBackgroundImage(nil, for: UIBarMetrics.default)            self.navigationController?.navigationBar.shadowImage = UIImage()    }

override func viewDidAppear(_ animated: Bool) {        self.navigationController?.navigationBar .setBackgroundImage(UIImage(), for: UIBarMetrics.default)        self.navigationController?.navigationBar.shadowImage = UIImage()    }

[如果您在阅读我的文章时有疑问 , 请点击这里](https://www.jianshu.com/p/1e68be1e6646)

你可能感兴趣的:(导航控制器全透明)