UINavigationBar全局方式自定义
2017-09-04 19:15
239 查看
UIImage *backButtonImage = [[UIImage imageNamed:@"navbar_ic_back.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 30, 30, 30)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[appearance setBackButtonBackgroundImage:leftButton
forState:1
barMetrics:UIBarMetricsDefault];
UIImage *image = [UIImage imageNamed:@"navbar_ic_back.png"];
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
navigationBar.backIndicatorImage = image;
navigationBar.backIndicatorTransitionMaskImage = image;
navigationBar.tintColor = [UIColor whiteColor];
//title加阴影
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);
[navigationBar 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]];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[appearance setBackButtonBackgroundImage:leftButton
forState:1
barMetrics:UIBarMetricsDefault];
UIImage *image = [UIImage imageNamed:@"navbar_ic_back.png"];
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
navigationBar.backIndicatorImage = image;
navigationBar.backIndicatorTransitionMaskImage = image;
navigationBar.tintColor = [UIColor whiteColor];
//title加阴影
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);
[navigationBar 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]];
相关文章推荐
- 使用vue.use(##)构建全局方法,用this.$##使用,同时给自定义的方法 传递component调用其方法 //eventHub
- easyui 自定义校验使用ajax方式。
- 通过自定义MessageFilter的方式利用按键操作控件滚动条
- 自定义Cell注册两种方式
- 3-Spring Boot ( 全局捕获异常 与 自定义异常 )
- 自定义php开发环境搭建以及两种方式的比较总结
- 多线程中的全局信息统计的一种简单实现方式(java实现)
- (3)自定义服务器,用户提交数据两种方式get,post区别
- Laravel实践-自定义全局异常处理
- Vue全局变量的实现方式
- C++内存分配方式详解——堆、栈、自由存储区、全局/静态存储区和常量存储区
- spring AOP自定义注解方式实现日志管理
- .net中捕捉全局未处理异常的三种方式示例
- Struts2学习笔记(四)输入校验——自定义编码方式
- 自定义线程的创建方式
- 自定义方式保存session到文件
- 自定义Dialog的几种实现方式
- Android中的UI界面控制方式和自定义View
- struts2 自定义全局类型转换器
- Java多种方式自定义序列化