关于navigation那些事(笔记)

小结:

//导航栏颜色

[[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 下面加上阴影


关于navigation那些事(笔记)_第1张图片
效果图

创建一个NavigationBar的类别


关于navigation那些事(笔记)_第2张图片
添加方法,记得导入


关于navigation那些事(笔记)_第3张图片
调用这个方法就OK了

你可能感兴趣的:(关于navigation那些事(笔记))