iOS UINavinationController设置

``/**< 返回item颜色*/``

``[self.navigationController.navigationBarsetTintColor:[UIColorwhiteColor]];``

``/**< 导航栏背景*/``

``[self.navigationController.navigationBarsetBackgroundImage:[UIImageimageNamed:@"navigationImage.png"]forBarMetrics:UIBarMetricsDefault];``

``/**< 导航栏透明度*/``

``[self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent;[self.navigationController.navigationBarsetBackgroundImage:[UIImageimageNamed:@"o+x"]forBarMetrics:UIBarMetricsCompact];``

``/** < 不加会有横线*/``

``[self.navigationController.navigationBarsetValue:@(0)forKeyPath:@"backgroundView.alpha"];self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent;``

``/**< 修改字体颜色及字体大小*/``

``[self.navigationController.navigationBar.titleTextAttributes=@{NSForegroundColorAttributeName:[UIColorwhiteColor],NSFontAttributeName:[UIFontboldSystemFontOfSize:17]};``

``// 设置导航栏透明``

``-(void)viewWillAppear:(BOOL)animated``

``{``

``    [superviewWillAppear:animated];``

``   [self.navigationController.navigationBar setBackgroundImage:[UIImage new]forBarMetrics:UIBarMetricsDefault];``

``   [self.navigationController.navigationBar setShadowImage:[UIImage new]];``

``}``

``-(void)viewWillDisappear:(BOOL)animated``

``{``

``    [superviewWillDisappear:animated];``

``    [self.navigationController.navigationBarsetBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];``

``   [self.navigationController.navigationBar setShadowImage:nil];``

``}``

你可能感兴趣的:(iOS UINavinationController设置)