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


效果图

创建一个NavigationBar的类别


添加方法,记得导入<QuartzCore/QuartzCore.h>


调用这个方法就OK了
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容