-(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的更多相关文章

  1. 自定义UITabbarController控制器

    自定义UITabbarController控制器 这是定制UITabbarController的基本原理,没有进行功能性封装. 效果:   源码地址: https://github.com/YouXi ...

  2. 自定义UITabBarController

    用的时候直接拷贝代码即可. 1.在AppDelegate设置跟控制器为:PQTabBarController #import "PQTabBarController.h" @int ...

  3. iOS-自定义 UITabBarController

    先来回顾一下UITabBarController ( 稍微详细的在在http://blog.csdn.net/yang198907/article/details/49807011) 伴随UITabB ...

  4. 自定义UITabBarController标签视图控制器

    首先创建一个类,继承自UItabBarController 然后在.m文件中: 这里我有两个宏定义: #define WIDTH (myView.frame.size.width / 4) //我在写 ...

  5. IOS开发之自定义UITabBarController

    UITabBarController是开发中经常会用到的一个视图控制器,但是默认的UITabBarController经常不能够完全满足我们的需求,所以我们经常需要自定义一个UITabBarContr ...

  6. iOS 自定义UITabBarController的tabBar

               #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDeleg ...

  7. UITabBarController底层实现

    1.首先要了解:任何控制器,都能添加子控制器      UIViewController里面有一个方法:     - (void)addChildViewController:(UIViewContr ...

  8. iOS去除导航栏和tabbar的1px横线

    1.在自己定义的导航栏中或者设计稿中经常需要去除导航栏的1px横线,主要是颜色太不协调了 去除之前的图片 要去除这1px的横线,首先应该知道它是什么,在Xcode的界面调试中可以看到,它其实是UIIm ...

  9. Unbalanced calls to begin/end appearance transitions for **

    在自定义UITabBarController中点击视图跳转的时候,有可能就出现这个问题, 解决方法就是在自定义的UITabBarController中的视图显示消失通知方法中添加如下方法: - (vo ...

随机推荐

  1. POJ 3349 Snowflake Snow Snowflakes(哈希)

    http://poj.org/problem?id=3349 题意 :分别给你n片雪花的六个角的长度,让你比较一下这n个雪花有没有相同的. 思路:一开始以为把每一个雪花的六个角的长度sort一下,然后 ...

  2. JavaScript注入漏洞的原理及防范

    初次接触: 初次接触JavaScript注入漏洞后,如果不对这种漏洞的作用机理仔细分析并提取出其发生的某种模式,你就不能做到快速的发现项目中可能存在的所有注入风险并在代码中防范. 发生模式: Java ...

  3. SQL模糊查询与删除多条语句复习

    string IDlist="1,2,3"; 批量删除数据 StringBuilder strsql=new StringBuilder(); strSql.Append(&quo ...

  4. Java泛型反射机制(一)

    /** * * @author Administrator * 功能:泛型的必要性(参数化类型)(安全简单) */ package com.test; import java.util.*; publ ...

  5. 弱安全协议探测工具-sslciphercheck

    SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为 网络通信提供安全及数据完整性的一种安全协议.TLS ...

  6. ruby 编写迭代器

    class My def initialize(name,age) @name=name @age=age end def sayName puts @name end def sayAge puts ...

  7. HDU 2493 Timer 数学(二分+积分)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2493 题意:给你一个圆锥,水平放置,圆锥中心轴与地面平行,将圆锥装满水,在圆锥某一表面开一个小洞,流出来 ...

  8. Eclipse中输入系统变量和运行参数

    在开发时,有时候可能需要根据不同的环境设置不同的系统参数,我们都知道,在使用java -jar命令时可以使用-D参数来设置运行时的系统变量,同样,在Eclipse中运行java程序时,我们怎么设置该系 ...

  9. BZOJ_1270_雷涛的小猫_(动态规划)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1270 有n棵树,高度为h.一只猫从任意一棵树的树顶开始,每次在同一棵树上下降1,或者跳到其他树 ...

  10. redis 用setbit(bitmap)统计活跃用户

    getspool.com的重要统计数据是实时计算的.Redis的bitmap让我们可以实时的进行类似的统计,并且极其节省空间.在模拟1亿2千8百万用户的模拟环境下,在一台MacBookPro上,典型的 ...