xcode6 自定义UITabbarController
-(void)initTabBarView{
if (tabBarController && [kAPPDELEGATE.navigationController.viewControllers containsObject:tabBarController]) {
[kAPPDELEGATE.navigationController popToViewController:tabBarController animated:YES];
return;
}
[kAPPDELEGATE.navigationController popToRootViewControllerAnimated:NO];
[[UIApplication sharedApplication] setStatusBarHidden:NO];
NSMutableArray *controllers = [NSMutableArray array]; //UIImageRenderingModeAlwaysOriginal 图片按照原样渲染。
{
SchoolSecondHandViewController *vc = [[SchoolSecondHandViewController alloc] initWithNibName:nil bundle:nil];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle: @"首页" image:[[UIImage imageNamed:@"tabbar_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_home_press"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]]; [item setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys: [UIColor redColor],
NSForegroundColorAttributeName, nil] forState:UIControlStateHighlighted];
vc.tabBarItem = item;
[controllers addObject:vc];
}
{ CollectSomeThingViewController *vc = [[CollectSomeThingViewController alloc] initWithNibName:nil bundle:nil];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle: @"首页" image:[[UIImage imageNamed:@"tabbar_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_home_press"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[item setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys: [UIColor redColor],
NSForegroundColorAttributeName, nil] forState:UIControlStateHighlighted];
vc.tabBarItem = item;
[controllers addObject:vc]; }
{ LossSomeThingViewController *vc = [[LossSomeThingViewController alloc] initWithNibName:nil bundle:nil]; UITabBarItem *item = [[UITabBarItem alloc] initWithTitle: @"首页" image:[[UIImage imageNamed:@"tabbar_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_home_press"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[item setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys: [UIColor redColor],
NSForegroundColorAttributeName, nil] forState:UIControlStateHighlighted];
vc.tabBarItem = item;
[controllers addObject:vc]; }
{ MoreViewController *vc = [[MoreViewController alloc] initWithNibName:nil bundle:nil];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle: @"首页" image:[[UIImage imageNamed:@"tabbar_home"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"tabbar_home_press"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[item setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys: [UIColor redColor],
NSForegroundColorAttributeName, nil] forState:UIControlStateHighlighted];
vc.tabBarItem = item;
[controllers addObject:vc]; } tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBarController.delegate = self;
tabBarController.tabBar.clipsToBounds = TRUE; {
tabBarController.tabBar.tintColor = kDEFAULT_BG_COLOR;
[[UITabBar appearance] setBackgroundImage:[ZQUtiles imageWithColor:kDEFAULT_BG_COLOR size:CGSizeMake(, )]];//设置背景,修改颜色是没有用的 [[UITabBar appearance] setSelectionIndicatorImage:[ZQUtiles imageWithColor:kDEFAULT_BG_COLOR size:CGSizeMake(, )]];
}
[tabBarController setViewControllers:controllers];
[kAPPDELEGATE.navigationController pushViewController:tabBarController animated:YES];
}
xcode6 自定义UITabbarController的更多相关文章
- 自定义UITabbarController控制器
自定义UITabbarController控制器 这是定制UITabbarController的基本原理,没有进行功能性封装. 效果: 源码地址: https://github.com/YouXi ...
- 自定义UITabBarController
用的时候直接拷贝代码即可. 1.在AppDelegate设置跟控制器为:PQTabBarController #import "PQTabBarController.h" @int ...
- iOS-自定义 UITabBarController
先来回顾一下UITabBarController ( 稍微详细的在在http://blog.csdn.net/yang198907/article/details/49807011) 伴随UITabB ...
- 自定义UITabBarController标签视图控制器
首先创建一个类,继承自UItabBarController 然后在.m文件中: 这里我有两个宏定义: #define WIDTH (myView.frame.size.width / 4) //我在写 ...
- IOS开发之自定义UITabBarController
UITabBarController是开发中经常会用到的一个视图控制器,但是默认的UITabBarController经常不能够完全满足我们的需求,所以我们经常需要自定义一个UITabBarContr ...
- iOS 自定义UITabBarController的tabBar
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDeleg ...
- UITabBarController底层实现
1.首先要了解:任何控制器,都能添加子控制器 UIViewController里面有一个方法: - (void)addChildViewController:(UIViewContr ...
- iOS去除导航栏和tabbar的1px横线
1.在自己定义的导航栏中或者设计稿中经常需要去除导航栏的1px横线,主要是颜色太不协调了 去除之前的图片 要去除这1px的横线,首先应该知道它是什么,在Xcode的界面调试中可以看到,它其实是UIIm ...
- Unbalanced calls to begin/end appearance transitions for **
在自定义UITabBarController中点击视图跳转的时候,有可能就出现这个问题, 解决方法就是在自定义的UITabBarController中的视图显示消失通知方法中添加如下方法: - (vo ...
随机推荐
- python登录豆瓣,发帖
学习了urllib.urllib2及cookielib常用方法的使用登录豆瓣,由于有验证码,采取的办法是将验证码图片下载到同目录下,查看图片后输入验证码即可登录.发帖帖子内容写死在代码中了 [Pyth ...
- Jquery.Validate验证CheckBoxList,RadioButtonList,DropDownList是否选中
http://blog.csdn.net/fox123871/article/details/8108030 <script type="text/javascript"&g ...
- Altium Designer学习: 原理图和PCB元件对应查找
画PCB的时候,需要经常的去查看原理图上对应的元件,元件数目少还好找,数目多了找起来就比较扯淡.还要Altium Designer提供了不错的交叉查找功能. 这里我建议使用两个显示器,一个显示器放原理 ...
- 奇怪的JS
有的时候发现JS是一门很高深的语言,不是我等俗人可以学会,没有private,没有public不说,居然连Class都没有,这个世界就是这样,有的东西你不一定非要想通,也不一定非要剖根问底,有的时候你 ...
- 我的第一个Spring程序
1.程序结构 2.各个文件 ByeService.java package com.service; public class ByeService { private String name; pu ...
- hadoop 原理: 浅析Hadoop文件格式
Hadoop 作为MR 的开源实现,一直以动态运行解析文件格式并获得比MPP数据库快上几倍的装载速度为优势.不过,MPP数据库社区也一直批评Hadoop由于文件格式并非 为特定目的而建,因此序列化和反 ...
- URI Scheme
1. 什么是URI Scheme? 一般情况下,遇到这种概念不清的问题,最好的第一手资料就是wiki,实在看不懂,再看百度百科,但前者给出的资料一般都是更加准确一些. 以下为维基百科和百度百科关于这个 ...
- uc浏览器qq浏览器广告过滤
- php加速缓存Xcache的安装与配置
安装环境:centos 6.5 32bit php5.5.7 nginx1.6.0 [root@localhost opt]# wget http://xcache.lighttpd.net/pub ...
- meta你到底了解多少
最近看meta在移动端的使用,发现好多东西有必要整理一下. meta是神马?有神马作用? meta是用来在HTML文档中模拟HTTP协议的响应头报文.meta 标签用于网页的<head>与 ...