1 、统一设置nav标题样式:

- (void)_setNavigationTitle {
NSDictionary *navigationParams = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont fontWithName:@"FZLBJW--GB1-0" size:]};
[[UINavigationBar appearance]setTitleTextAttributes:navigationParams];
}

2 、统一设置nav相关颜色:

- (void)_setNavigationColor {
[[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"FZLBJW--GB1-0" size:],NSForegroundColorAttributeName:[UIColor blackColor]}];
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
}

3 、统一设置返回按钮:

- (void)_setNavigationBackItem {
UINavigationBar * navigationBar = [UINavigationBar appearance];
UIImage *image = [UIImage imageNamed:@"back"];
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
navigationBar.backIndicatorImage = image;
navigationBar.backIndicatorTransitionMaskImage = image;
UIBarButtonItem *buttonItem = [UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil];
UIOffset offset;
offset.horizontal = - ;
offset.vertical = ;//不为0在iOS11会造成视图错乱
[buttonItem setBackButtonTitlePositionAdjustment:offset forBarMetrics:UIBarMetricsDefault];
}

4 、统一设置tableViewCell的分割线:

- (void)_setTableViewAppearace {
[[UITableView appearance]setTableFooterView:[UIView new]];
[[UITableView appearance]setSeparatorInset:UIEdgeInsetsZero];
}

5 、统一设置SegmentedControl

    UISegmentedControl *appearance = [UISegmentedControl appearance];  

    //Segmenteg正常背景
[appearance setBackgroundImage:[UIImage imageNamed:@"Segmente.png"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault]; //Segmente选中背景
[appearance setBackgroundImage:[UIImage imageNamed:@"Segmente_a.png"]
forState:UIControlStateSelected
barMetrics:UIBarMetricsDefault]; //Segmente左右都未选中时的分割线
//BarMetrics表示navigation bar的状态,UIBarMetricsDefault 表示portrait状态(44pixel height),UIBarMetricsLandscapePhone 表示landscape状态(32pixel height) [appearance setDividerImage:[UIImage imageNamed:@"Segmente_line.png"]
forLeftSegmentState:UIControlStateNormal
rightSegmentState:UIControlStateNormal
barMetrics:UIBarMetricsDefault]; [appearance setDividerImage:[UIImage imageNamed:@"Segmente_line.png"]
forLeftSegmentState:UIControlStateSelected
rightSegmentState:UIControlStateNormal
barMetrics:UIBarMetricsDefault]; [appearance setDividerImage:[UIImage imageNamed:@"Segmente_line.png"]
forLeftSegmentState:UIControlStateNormal
rightSegmentState:UIControlStateSelected
barMetrics:UIBarMetricsDefault]; //字体
NSDictionary *textAttributes1 = @{UITextAttributeFont: [UIFont systemFontOfSize:],
UITextAttributeTextColor: [UIColor blueColor],
UITextAttributeTextShadowColor: [UIColor whiteColor],
UITextAttributeTextShadowOffset: [NSValue valueWithCGSize:CGSizeMake(, )]}; [appearance setTitleTextAttributes:textAttributes1 forState:]; NSDictionary *textAttributes2 = @{UITextAttributeFont: [UIFont systemFontOfSize:],
UITextAttributeTextColor: [UIColor whiteColor],
UITextAttributeTextShadowColor: [UIColor blackColor],
UITextAttributeTextShadowOffset: [NSValue valueWithCGSize:CGSizeMake(, )]}; [appearance setTitleTextAttributes:textAttributes2 forState:];

6 、统一设置BarButton

    //修改导航条上的UIBarButtonItem
UIBarButtonItem *appearance = [UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil nil]; //设置导航栏的字体包括backBarButton和leftBarButton,rightBarButton的字体
NSDictionary *textAttributes = @{UITextAttributeFont: [UIFont systemFontOfSize:],
UITextAttributeTextColor: [UIColor blueColor],
UITextAttributeTextShadowColor: [UIColor whiteColor],
UITextAttributeTextShadowOffset: [NSValue valueWithCGSize:CGSizeMake(, )]}; [appearance setTitleTextAttributes:textAttributes forState:];//forState为0时为下正常状态,为1时为点击状态。 //修改leftBarButton,rightBarButton背景效果
[appearance setBackgroundImage:[UIImage imageNamed:@"navBarButton.png"]
forState:UIControlStateNormal
style:UIBarButtonItemStyleBordered
barMetrics:UIBarMetricsDefault]; [appearance setBackgroundImage:[UIImage imageNamed:@"navBarButton_a.png"]
forState:UIControlStateHighlighted
style:UIBarButtonItemStyleBordered
barMetrics:UIBarMetricsDefault]; //backBarButton需要单独设置背景效果。只能在ios6.0以后才能用
[appearance setBackButtonBackgroundImage:[UIImage imageNamed:@"nav_bg.png"]
forState:
barMetrics:UIBarMetricsDefault]; [appearance setBackButtonBackgroundImage:[UIImage imageNamed:@"work.png"]
forState:
barMetrics:UIBarMetricsDefault]; [appearance setBackButtonTitlePositionAdjustment:UIOffsetMake(, -)
forBarMetrics:UIBarMetricsDefault];

7 、统一设置工具栏:

 UIToolbar *appearance = [UIToolbar appearance];
//样式和背景二选一即可,看需求了
//样式(黑色半透明,不透明等)设置
[appearance setBarStyle:UIBarStyleBlackTranslucent];
//背景设置
[appearance setBackgroundImage:[UIImage imageNamed:@"toolbarBg.png"]
forToolbarPosition:UIToolbarPositionAny
barMetrics:UIBarMetricsDefault];

8 、统一设置系统View的tintColor:

关于tintColor的介绍请移步:https://www.jianshu.com/p/4bcaf6349133

        UIView.appearance().tintColor = UIColor(named: "Deep Carmine Pink")

你会发现系统默认的颜色从蓝色变为了 Deep Carmine Pink!(backBarItem也是红色只是被覆盖层改变了)

iOS 统一配置的更多相关文章

  1. 基于ZK构建统一配置中心的方案和实践

    背景: 近期使用Zk实现了一个简单的配置管理的小东西,在此开源出来,有兴趣的希望提出您的宝贵意见.如果恰巧您也使用或者接触过类似的东西, 也希望您可以分享下您觉得现在这个项目可以优化和改进的地方. 项 ...

  2. Android 100多个Styles快速开发布局XML,一行搞定View属性,一键统一配置UI...

    Android开发中大量使用XML代码作为界面的布局,使用styles能大幅精简XML代码. 比如下面这个界面从AlertDialog至PlacePickerWindow有19个样式相同的跳转Item ...

  3. IOS APP配置.plist汇总(转自coolweather )

    IOS APP配置.plist汇总(转自coolweather ) 此文转自http://www.cocoachina.com/bbs/read.php?tid=89684&page=1 作者 ...

  4. JBOSS EAP 6 系列五 Managed domains 管理域最主要的功能是“统一部署,统一配置”

    摘要 本文首先介绍Managed Domain的概念,管理域最主要的功能是"统一部署,统一配置".接下来通过一个实例在"统一配置"部分实现一个双机配置起来的域, ...

  5. .NET Core微服务之基于Apollo实现统一配置中心

    Tip: 此篇已加入.NET Core微服务基础系列文章索引 一.关于统一配置中心与Apollo 在微服务架构环境中,项目中配置文件比较繁杂,而且不同环境的不同配置修改相对频繁,每次发布都需要对应修改 ...

  6. springcloud-spring cloud config统一配置中心

    统一配置中心 为什么需要统一配置中心? 统一配置中心顾名思义,就是将配置统一管理,配置统一管理的好处是在日后大规模集群部署服务应用时相同的服务配置一致,日后再修改配置只需要统一修改全部同步,不需要一个 ...

  7. 多个SpringMVC项目配置统一管理(来自于springCloud的统一配置思路)

    因公司项目分多个系统进行开发,而系统架构几乎完全一样,所以同样的配置文件会存在不同的系统中 当其中的某些配置需要修改时,就需要依次把所有系统中相关的配置都修改掉 纯耗时且没技术含量的体力活 所以借鉴S ...

  8. 基于Apollo实现.NET Core微服务统一配置(测试环境-单机)

    一.前言 注:此篇只是为测试环境下的快速入门.后续会给大家带来生产环境下得实战开发. 具体的大家可以去看官方推荐.非常的简单明了.以下介绍引用官方内容: Apollo(阿波罗)是携程框架部门研发的分布 ...

  9. Android多个Module统一配置相同jar或库的版本号

    Android Studio多个Module依赖相同的库时对版本号进行统一配置 在Android项目中,一个项目经常会依赖其他的一个甚至多个库文件,在这种依赖的时候最常见的一个错误就是 jar包版本不 ...

随机推荐

  1. SpringBoot集成TkMybatis插件 (二)

    一.Tkmybatis的好处 Tkmybatis是在mybatis框架的基础上提供了很多工具,让开发更加高效.这个插件里面封装好了我们需要用到的很多sql语句,不过这个插件是通过我们去调用它封装的各种 ...

  2. 如何通过ssh远程登录内网的Mac和Linux系统?

    神器:ngrok 用法很简单,安装后 验证授权: ./ngrok authtoken 3WWujp1TEtHRo6rphEi5Y_7MBqGWm9yThCSFyqEHgip 在内网开启tcp服务 ng ...

  3. Exception:public class feign.codec.EncodeException feign.codec.EncodeException: 'Content-Type' cannot contain wildcard type '*'

    一.异常出现的场景  Spring Cloud 服务A通过feign调用服务B;之前是好好的,但今天突然就不好了,抛以下异常===> 出现原因补充,Spring Boot默认的JSON方式 Ja ...

  4. TP5中即点即改,json分页,单删

    HTML页面: <!doctype html><html lang="en"><head> <meta charset="UTF ...

  5. 在word中粘贴的图片为什么显示不完整

    一.背景 整理系统测试说明文档,截得图片粘贴到word中显示不完整. 二.错误问题 问题:在word中粘贴的图片为什么显示不完整,如图所示: 三.分析问题: 原因是原来设置的行间距是固定值,图片也作一 ...

  6. csu oj 1342: Double

    Description 有一个由M个整数组成的序列,每次从中随机取一个数(序列中每个数被选到的概率是相等的)累加,一共取N次,最后结果能被3整除的概率是多少? Input 输入包含多组数据.     ...

  7. Linux下使用mail发送邮件

    邮件常常是Linux下监控报警手段之一.Linux下的mail命令可以方便,快速的完成发送邮件.下面以CentOS为例 1.安装 [root@vm8028 ~]# mail -bash: mail: ...

  8. Echarts 简单报表系列一:柱状图

    见代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...

  9. [contest 781] 9.6

    [contest 781] 9.6 - XJOI czx的温暖题... T1 军训

  10. noip2016组合数问题

    题目描述 组合数 Cnm​ 表示的是从 n 个物品中选出 m 个物品的方案数.举个例子,从 (1,2,3) 三个物品中选择两个物品可以有(1,2),(1,3),(2,3) 这三种选择方法.根据组合数的 ...