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 ...
随机推荐
- [JAVA]各种杂七杂八的东西......
BigInteger / BigDecimal / string 一些常用的函数: 加 add减 substract乘 multiply除 divid取余 mod / remainder (remin ...
- GridView使用CommandField删除列实现删除时提示确认框
在.net2005提供的GridView中我们可以直接添加一个CommandField删除列完后在它的RowDeleting事件中完成删除 GridView在使用CommandField删除时弹出提示 ...
- session跨域共享解决方案
要让session跨域共享,需要解决三个问题: 1.通过什么方法来传递session_id? 2.通过什么方法来保存session信息? 3.通过什么方法来进行跨域? 一.传递session_id有4 ...
- SPRING IN ACTION 第4版笔记-第七章Advanced Spring MVC-006- 如何保持重定向的request数据(用model、占位符、RedirectAttributes、model.addFlashAttribute("spitter", spitter);)
一.redirect为什么会丢数据? when a handler method completes, any model data specified in the method is copied ...
- 如何用C#获得文件信息以及扩展信息
在C#中获得文件信息很容易,只需要用FileInfo类或者FileVersionInfo类就可以获得,但是如果想要获得文件的扩展信息,则无法从这两类来获得.不过在C#中,这也不是件难事,只要引入“Mi ...
- 在Sublime Text 3中配置编译和运行Java程序
设置Java的PATH环境变量 在Java的jdk的bin目录下建立新文件runJava.bat 文件内容如下: @echo off cd %~dp1 echo Compiling %~nx1.... ...
- VM8下安装Mac OS X 10.7
下载Mac OS X 10.7 安装包http://115.com/file/clj1iu8m# 下载HJMac http://115.com/file/cljyu1rh# ...
- PHP静态化之真静态化
参考文献:http://blog.sina.com.cn/s/blog_66aa1142010114lc.html 采用了动态服务器技术生成静态HTML的做法,这样做的好处是:一是能减轻其服务器的负担 ...
- jQuery-单击文字或图片内容放大显示效果插件
css很强大,jQuery也很强大,两者结合在一起就是无比强大.这里要介绍的这个单击文字或图片内容放大居中显示的效果就是这两者结合的产物. 先来介绍css和jQuery各自发挥了什么作用吧: css: ...
- [liu yanling]常用的测试工具
常用的测试工具 1. 功能测试工具——QTP 2. 性能测试工具——LoadRunner 3. 测试管理工具——TestDirector 4. 白盒测试工具——Nunit,Junit,C++Test, ...