taiyang2014

iOS 设置navigationBar背景

- (void)viewWillAppear:(BOOL)animated {
    [superviewWillAppear:animated];
    [self.navigationController.navigationBarsetBackgroundImage:[UIImageimageNamed:@"searchBackground"]forBarMetrics:UIBarMetricsDefault];
}
如果自在当前这个页面设置背景色..需要在试图将要消失的时候修改回来主色调

- (void)viewWillDisappear:(BOOL)animated {

    [super viewWillDisappear:animated];

    navBarHairlineImageView.hidden = NO;

    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:kNavDeepColor] forBarMetrics:UIBarMetricsDefault];

}

 

posted on 2016-09-26 17:16  taiyang2014  阅读(188)  评论(0编辑  收藏  举报

导航