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 ...
随机推荐
- unity 引用 移动mm 支付sdk
原地址:http://blog.csdn.net/u012085988/article/details/17531005 资源下载:http://download.csdn.net/detail/u0 ...
- Bootstrap 貌似不错,先做一下记录
Bootstrap 简洁.直观.强悍的前端开发框架,让web开发更迅速.简单. http://www.bootcss.com/
- 【无聊放个模板系列】HDU 3068 MANACHER
#include<cstdio> #include<cstdlib> #include<cstring> #include<iostream> #inc ...
- easyui源码翻译1.32--Tree(树)
前言 使用$.fn.tree.defaults重写默认值对象.下载该插件翻译源码 树控件在web页面中一个将分层数据以树形结构进行显示.它提供用户展开.折叠.拖拽.编辑和异步加载等功能. 源码 /** ...
- easyui源码翻译1.32--TreeGrid(树形表格)
前言 扩展自$.fn.datagrid.defaults.使用$.fn.treegrid.defaults重写默认值对象.下载该插件翻译源码 树形表格用于显示分层数据表格.它是基于数据表格.组合树控件 ...
- DHTMLX 前端框架 建立你的一个应用程序 教程(十一)--添加/删除表格中的记录
添加/删除表格中的记录 我们的最终功能是在表格中添加删除 我们通过单机工具栏上的按钮来实现添加删除 当我们单击添加按钮的时候, 表单中 第一行默认填写New contact 光标自动聚焦 当用户点击删 ...
- 167. Two Sum II - Input array is sorted
题目: Given an array of integers that is already sorted in ascending order, find two numbers such that ...
- Drawable(3)Color State List Resource
注意 Color State List Resource 与 Color不同,前者是颜色状态表.根据不同状态显示不同颜色,它是State list,里面有多种颜色,后者只是一个颜色. Color St ...
- jquery ajax cache的问题
function test() { $.ajax({ type:'GET', url:"tt. ...
- 登陆与注册以及Session
Session 保存状态是在 登陆窗口 检查用户密码的动作上执行 .Models namespace 注册与登陆以及Session.Models { public class UserBF { p ...