CYLTabBarController的简单使用
#pragma mark- 登录成功跳转至主页
-(void)jumpToMainVC {
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; NSArray *normalImage = @[@"notice_icon_normal", @"news_icon_normal", @"contacts_icon_normal", @"application_icon_normal"];
NSArray *selectImage = @[@"notice_icon_pressed", @"news_icon_pressed", @"contacts_icon_pressed", @"application_icon_pressed"];
NSArray *vcClass = @[@"NotifyViewController", @"NewsViewController", @"ContactsViewController", @"ApplicationViewController"];
NSArray *titleArray = @[@"通知", @"新闻", @"联系人", @"应用"];
NSMutableArray *allArray = [NSMutableArray array]; for (int i = ; i < ; i++) {
Class cla = NSClassFromString(vcClass[i]);
UIViewController *vc = [[cla alloc] init];
vc.navigationItem.title = titleArray[i];
[vc.tabBarItem setTitle:titleArray[i]];
[vc.tabBarItem setImage:[[UIImage imageNamed:normalImage[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[vc.tabBarItem setSelectedImage:[[UIImage imageNamed:selectImage[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:vc];
[allArray addObject:nav];
}
UITabBarController *tab = [[UITabBarController alloc] init];
tab.viewControllers = allArray; //设置navigationBar样式
[self setUpNavigationBarAppearance];
//tabBarItem 的选中和不选中文字属性
[self setUpTabBarItemTextAttributes]; self.window.rootViewController = tab; //打开收藏的数据库
[[CollectDataCenter shareInstance] openDataBase];
} /**
* 设置navigationBar样式
*/
- (void)setUpNavigationBarAppearance {
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
UIImage *backgroundImage = nil;
NSDictionary *textAttributes = nil; if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
backgroundImage = [UIImage imageNamed:@"navigationBar_BG"]; textAttributes = @{
NSFontAttributeName: [UIFont boldSystemFontOfSize:],
NSForegroundColorAttributeName: [UIColor whiteColor],
};
} else {
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
backgroundImage = [UIImage imageNamed:@"navigationBar_BG"]; textAttributes = @{
UITextAttributeFont: [UIFont boldSystemFontOfSize:],
UITextAttributeTextColor: [UIColor blackColor],
UITextAttributeTextShadowColor: [UIColor clearColor],
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetZero],
};
#endif
} [navigationBarAppearance setBackgroundImage:backgroundImage
forBarMetrics:UIBarMetricsDefault];
[navigationBarAppearance setTitleTextAttributes:textAttributes];
} /**
* tabBarItem 的选中和不选中文字属性
*/
- (void)setUpTabBarItemTextAttributes { // 普通状态下的文字属性
NSMutableDictionary *normalAttrs = [NSMutableDictionary dictionary];
normalAttrs[NSForegroundColorAttributeName] = RGBA(, , , ); // 选中状态下的文字属性
NSMutableDictionary *selectedAttrs = [NSMutableDictionary dictionary];
selectedAttrs[NSForegroundColorAttributeName] = RGBA(, , , ); // 设置文字属性
UITabBarItem *tabBar = [UITabBarItem appearance];
[tabBar setTitleTextAttributes:normalAttrs forState:UIControlStateNormal];
[tabBar setTitleTextAttributes:selectedAttrs forState:UIControlStateSelected]; // 设置背景图片
UITabBar *tabBarAppearance = [UITabBar appearance];
[tabBarAppearance setBackgroundImage:[UIImage imageNamed:@"tabbarBG"]];
// tabBarAppearance.barTintColor = [UIColor lightGrayColor];
} 显示界面显示如下:

CYLTabBarController的简单使用的更多相关文章
- iOS:CYLTabBarController【低耦合集成TabBarController】
导航 与其他自定义TabBarController的区别 集成后的效果 项目结构 使用CYLTabBarController 第一步:使用CocoaPods导入CYLTabBarController ...
- 【造轮子】打造一个简单的万能Excel读写工具
大家工作或者平时是不是经常遇到要读写一些简单格式的Excel? shit!~很蛋疼,因为之前吹牛,就搞了个这东西,还算是挺实用,和大家分享下. 厌烦了每次搞简单类型的Excel读写?不怕~来,喜欢流式 ...
- Fabio 安装和简单使用
Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...
- node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理
一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...
- 哪种缓存效果高?开源一个简单的缓存组件j2cache
背景 现在的web系统已经越来越多的应用缓存技术,而且缓存技术确实是能实足的增强系统性能的.我在项目中也开始接触一些缓存的需求. 开始简单的就用jvm(java托管内存)来做缓存,这样对于单个应用服务 ...
- 在Openfire上弄一个简单的推送系统
推送系统 说是推送系统有点大,其实就是一个消息广播功能吧.作用其实也就是由服务端接收到消息然后推送到订阅的客户端. 思路 对于推送最关键的是服务端向客户端发送数据,客户端向服务端订阅自己想要的消息.这 ...
- 我的MYSQL学习心得(一) 简单语法
我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(五) 运 ...
- 使用 Nodejs 搭建简单的Web服务器
使用Nodejs搭建Web服务器是学习Node.js比较全面的入门教程,因为要完成一个简单的Web服务器,你需要学习Nodejs中几个比较重要的模块,比如:http协议模块.文件系统.url解析模块. ...
- ASP.NET Aries 入门开发教程2:配置出一个简单的列表页面
前言: 朋友们都期待我稳定地工作,但创业公司若要躺下,也非意念可控. 若人生注定了风雨飘摇,那就雨中前行了. 最机开始看聊新的工作机会,欢迎推荐,创业公司也可! 同时,趁着自由时间,抓紧把这系列教程给 ...
随机推荐
- 并发编程大师系列之:线程的定义和中断 interrupt
1.启动线程的三种方式: 1.1继承Thread类 public static class UseThread extends Thread { public void run() { System. ...
- 对比AngularJS/jQueryUI/Extjs:没有一个框架是万能的
AngularJS不能做什么?对比Angular/JSjQueryUI/Extjs 框架就好比兵器,你得明白你手里拿的是屠龙刀还是倚天剑,刀法主要是砍,剑法主要是刺.对于那些职业喷子和脑残粉,小僧送你 ...
- pandas 数据类型研究(一)数据转换
当利用pandas进行数据处理的时候,经常会遇到数据类型的问题,当拿到数据的时候,首先需要确定拿到的是正确类型的数据,一般通过数据类型的转化,这篇文章就介绍pandas里面的数据类型(data typ ...
- VFD 时钟(VFD Clock with STM8 v2.0)
算是填了最先挖的VFD坑 最近pcb厂家神仙打架,为PCB普及做出了巨大贡献,到这事儿发生我也就开了两三次板,都赶上这个时间了,不开白不开! 不说了,上图! sch: pcb: 方案和之前的除了驱动电 ...
- selenium之python源码解读-expected_conditions
一.expected_conditions 之前在 selenium之python源码解读-WebDriverWait 中说到,until方法中method参数,需要传入一个function对象,如果 ...
- 最短路--Bellman-Ford
Bellman-Ford 贝尔曼-福特 算法思想 贝尔曼-福特算法(英语:Bellman–Ford algorithm),求解单源最短路径问题的一种算法,由理查德·贝尔曼 和 莱斯特·福特 创立的.它 ...
- xml介绍+xml创建+xml读取
1.xml介绍:(URL:https://blog.csdn.net/weixin_37861326/article/details/81082144) xml是用来传输内容的,是w3c推荐的 2.使 ...
- jQuery多选和单选下拉框插件select.js
一.插件描述 可通过参数设置多选或者单选,多选返回数组结果,单选返回字符串,如图: 下载地址:https://pan.baidu.com/s/1JjVoK89_ueVVpfSlMDJwUQ 提取码 ...
- Spring注解不生效
如果在使用spring中,发现注解不生效,检查下如下配置是否配置. 1:一般情况下@Autowired默认是不生效的,配置之后,才会生效 <context:annotation-config / ...
- getLocation需要在app.json中声明permission字段,解决办法
具体开发方法如下: 在 app.json 里面增加 permission 属性配置(小游戏需在game.json中配置): "permission": { "scope. ...