#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的简单使用的更多相关文章

  1. iOS:CYLTabBarController【低耦合集成TabBarController】

    导航 与其他自定义TabBarController的区别 集成后的效果 项目结构 使用CYLTabBarController 第一步:使用CocoaPods导入CYLTabBarController ...

  2. 【造轮子】打造一个简单的万能Excel读写工具

    大家工作或者平时是不是经常遇到要读写一些简单格式的Excel? shit!~很蛋疼,因为之前吹牛,就搞了个这东西,还算是挺实用,和大家分享下. 厌烦了每次搞简单类型的Excel读写?不怕~来,喜欢流式 ...

  3. Fabio 安装和简单使用

    Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...

  4. node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理

    一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...

  5. 哪种缓存效果高?开源一个简单的缓存组件j2cache

    背景 现在的web系统已经越来越多的应用缓存技术,而且缓存技术确实是能实足的增强系统性能的.我在项目中也开始接触一些缓存的需求. 开始简单的就用jvm(java托管内存)来做缓存,这样对于单个应用服务 ...

  6. 在Openfire上弄一个简单的推送系统

    推送系统 说是推送系统有点大,其实就是一个消息广播功能吧.作用其实也就是由服务端接收到消息然后推送到订阅的客户端. 思路 对于推送最关键的是服务端向客户端发送数据,客户端向服务端订阅自己想要的消息.这 ...

  7. 我的MYSQL学习心得(一) 简单语法

    我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(五) 运 ...

  8. 使用 Nodejs 搭建简单的Web服务器

    使用Nodejs搭建Web服务器是学习Node.js比较全面的入门教程,因为要完成一个简单的Web服务器,你需要学习Nodejs中几个比较重要的模块,比如:http协议模块.文件系统.url解析模块. ...

  9. ASP.NET Aries 入门开发教程2:配置出一个简单的列表页面

    前言: 朋友们都期待我稳定地工作,但创业公司若要躺下,也非意念可控. 若人生注定了风雨飘摇,那就雨中前行了. 最机开始看聊新的工作机会,欢迎推荐,创业公司也可! 同时,趁着自由时间,抓紧把这系列教程给 ...

随机推荐

  1. vue 对象更改检测注意事项

  2. JVM 平台上的 Scheme 语言实现 JSchemeMin

    JSchemeMin 是一个JVM平台上的Scheme语言实现. 作为R7RS的实现,JSchemeMin支持Scheme的所有标准特性,包括头等公民地位的过程.尾递归优化.继续.用户定义记录.库(包 ...

  3. 33、[源码]-AOP原理-获取拦截器链-MethodInterceptor

    33.[源码]-AOP原理-获取拦截器链-MethodInterceptor

  4. 使用$.getJSON("xx.json" ,function(data){ console.logy(data); })在本地获取 json数据

    使用 $.getJSON() 在本地获取 json数据  默认在谷歌,火狐等其他浏览器,不允许在本地获取服务器数据 所以不能在本地中使用 但是可以IE 11 中又可以使用,所以,测试时建议在IE浏览器 ...

  5. PHP 创建 MySQL 表

    CREATE TABLE 语句用于创建 MySQL 表. 创建表前,我们需要使用 use myDB 来选择要操作的数据库: use myDB; 我们将创建一个名为 "MyGuests&quo ...

  6. 洛谷 P3955 图书管理员 题解

    每日一题 day12 打卡 Analysis 模拟+快速幂 先把图书的编码存起来排序,保证第一个找到的就是最小的.如果要求一个数后x位,就将这个数模10的x次方,同理,我们可以通过这个规律来判断后缀. ...

  7. python一些实用的小工具

    1  搭一个简易的本地局域网  python -m http.server 2 获取当前目录下的所有文件名 3 进度条效果 import sys,time for i in range(50): sy ...

  8. TensorFlow(七):tensorboard网络执行

    # MNIST数据集 手写数字 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # ...

  9. 数据结构实验之图论十:判断给定图是否存在合法拓扑序列(SDUT 2140)

    分析:BFS判断是否有环. #include<bits/stdc++.h> using namespace std; typedef long long ll; int gra[200][ ...

  10. python 小数处理

    modf() 分别取整数部分和小数部分 math模块函数import mathn = 3.75print(math.modf(n))>>> (0.75, 3.0)n = 3.25pr ...