navigationBar的透明问题

(1)如果仅仅想要navigationBar透明,按钮和标题都在。

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

(2)去掉导航的分割线的就需要在加入一句话:

 self.navigationController.navigationBar.shadowImage = [UIImage new];

如果你想要实现上拉导航渐变的就需要从它的内部入手

  [self.navigationController.navigationBar subviews] objectAtIndex:0].alpha = 0;//这里可以根据scrollView的偏移量来设置alpha就实现了渐变透明的效果

3、全局设置navigationBar标题的样式和barItem的标题样式

//UIColorWithHexRGB( )这个方法是自己定义的,这里只需要给个颜色就好了

[[UINavigationBar appearance] setBarTintColor:UIColorWithHexRGB(0xfefefe)];

[[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18],NSForegroundColorAttributeName:UIColorWithHexRGB(0xfe6d27)}];

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:10],NSForegroundColorAttributeName : UIColorWithHexRGB(0x666666)} forState:UIControlStateNormal];

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSiz】;

 

posted @ 2016-08-10 14:42  qinxiaoguang  阅读(215)  评论(0编辑  收藏  举报