小结:
//导航栏颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor blackColor]];
//导航栏模糊处理 默认为YES
[[UINavigationBar appearance] setTranslucent:YES];
//导航栏设置背景图片
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
//导航栏标题风格
NSShadow *shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
shadow.shadowOffset = CGSizeMake(0, 1);
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
shadow, NSShadowAttributeName,
[UIFont fontWithName:@ "HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];
//导航栏透明
[self.navigationBar setBackgroundImage:[UIImage new]
forBarMetrics:UIBarMetricsDefault];
self.navigationBar.shadowImage = [UIImage new];
self.navigationBar.translucent = YES;
//滑动的时候隐藏navigationbar
self.navigationController.hidesBarsOnSwipe = YES;
//去掉导航返回键带的title
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
//改变状态栏风格
//需要在project target的Info tab中,插入一个新的key,名字为View controller-based status bar appearance,并将其值设置为NO。
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//隐藏状态栏
[[UIApplication sharedApplication] setStatusBarHidden:YES];
----------------------------------------分割线 -----------------------------------
如何在navigation 下面加上阴影
创建一个NavigationBar的类别