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 ...
随机推荐
- Jquery 操作Html 控件 CheckBox、Radio、Select 控件
在使用 Javascript 编写前台脚本的时候,经常会操作 Html 控件,比如 checkbox.radio.select,用 Jquery 库操作其他会方便很多,下面用Jq对这些控件的操作进行一 ...
- ZOJ - 3195 Design the city
题目要对每次询问将一个树形图的三个点连接,输出最短距离. 利用tarjan离线算法,算出每次询问的任意两个点的最短公共祖先,并在dfs过程中求出离根的距离.把每次询问的三个点两两求出最短距离,这样最终 ...
- 实时时钟、系统时钟和CPU时钟的区别
http://blog.sina.com.cn/s/blog_68f909c30100pli7.html 实时时钟:RTC时钟,用于提供年.月.日.时.分.秒和星期等的实时时间信息,由后备电池供电,当 ...
- D-Bus,kdbus和Binder
http://blog.sina.com.cn/s/blog_4af327e10101irie.html 材料来自:The unveiling of kdbus 和 Kdbus Details .后一 ...
- 【POJ】1505 Copying Books
此题主要采用DP思路,难点是求解"/",需要考虑划分数量不够的情况,先采用DP求解最优解,然后采用贪心求解slash.防止中间结果出错,使用了unsigned int. #incl ...
- Sublime Text修改显示图标
选择喜欢的图片 首先你需要选择一个中意的图片做为新的图标,格式可以是png,jpg,gif的 转为ico格式 我们需要ico格式的图片,所以需要将上述的图片转换一下格式.同样,转ico格式的软件很多, ...
- Azure Site Recovery 通过一键式流程将虚拟机故障转移至 Azure虚拟机
Ruturaj Dhekane 云 + Enterprise 项目经理 现在,AzureSite Recovery可以通过其"灾难恢复至 Azure"功能保护您的工作负荷,并 ...
- BrnShop开源网上商城第五讲:自定义视图引擎
今天这篇博文主要讲解自定义视图引擎,大家都知道在asp.net mvc框架中默认自带一个Razor视图引擎,除此之外我们也可以自定义自己的视图引擎,只需要实现IViewEngine接口,接口定义如下: ...
- android之handler obtainmessge与New message区别
obtainmessage()是从消息池中拿来一个msg 不需要另开辟空间new new需要重新申请,效率低,obtianmessage可以循环利用: //use Handler.obtainMess ...
- 一些有用的Azure工具
目前,Azure 没有为客户提供监控和管理托管服务的完整解决方案.为了获取网络信息,speedtest.net 提供了一种工具,用于测量响应时间.带宽和整体连接质量.可以使用 Matthew Roso ...