纯代码编写UITabBarController, 不多说,直接见代码

RViewController1 *vc1 = [[RViewController1 alloc]init];

    UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:vc1];
//只赋值 tabBarItem.title, 通过.title属性取值是取不到值
//navController.tabBarItem.title = @"Page 1"; //相当于对tabBarItem.title 和 navigationItem.title同时赋值
navController.title = @"Page 1";
navController.tabBarItem.image = [UIImage imageNamed:@"1.jpg"]; RViewController2 *vc2 = [[RViewController2 alloc]init];
vc2.title =@"Page 2";
// UITabBarItem *item2 = [[UITabBarItem alloc]initWithTitle:@"Page 2" image:[UIImage imageNamed:@"2.png" ] selectedImage:[UIImage imageNamed:@"2_pressed.png"]];
vc2.tabBarItem.image = [UIImage imageNamed:@"2.png"]; RViewController3 *vc3 = [[RViewController3 alloc]init];
vc3.title =@"Page 3";
vc3.tabBarItem.image = [UIImage imageNamed:@"3.png"]; RViewController4 *vc4 = [[RViewController4 alloc]init];
vc4.title =@"Page 4";
vc4.tabBarItem.image = [UIImage imageNamed:@"4.png"];
vc4.tabBarItem.badgeValue = @""; RViewController5 *vc5 = [[RViewController5 alloc]init]; //创建 UITabItem的实例
UITabBarItem *item1 = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemHistory tag:];
vc5.tabBarItem = item1; NSArray *controllers = [NSArray arrayWithObjects:navController,vc2,vc3,vc4, nil]; UITabBarController *tabController = [[UITabBarController alloc]init];
tabController.viewControllers = controllers; self.window.rootViewController = tabController;

UITabBarController 初学的更多相关文章

  1. 移动开发:初学 iOS-UIViewController 心得

    初学 iOS,本文翻译了一些 iOS 官网上的 UIViewController 的知识点,如有不到位或不正确的地方,还请指正: 本文所介绍的内容的目标: 理解content view control ...

  2. DDD初学指南

    去年就打算总结一下,结果新换的工作特别忙,就迟迟没有认真动手.主要内容是很多初学DDD甚至于学习很长时间的同学没有弄明白DDD是什么,适合什么情况.这世界上没有银弹,抛开了适合的场景孤立的去研究DDD ...

  3. gulp初学

    原文地址:gulp初学 至于gulp与grunt的区别,用过的人都略知一二,总的来说就是2点: 1.gulp的gulpfile.js  配置简单而且更容易阅读和维护.之所以如此,是因为它们的工作方式不 ...

  4. 初学seaJs模块化开发,利用grunt打包,减少http请求

    原文地址:初学seaJs模块化开发,利用grunt打包,减少http请求 未压缩合并的演示地址:demo2 学习seaJs的模块化开发,适合对seajs基础有所了解的同学看,目录结构 js — —di ...

  5. UITabBarController 升级定制

    UITabBarController 定制 特点 用法 1.准备工作: 加入你的相关图片,放入了Assets.xcassets; 导入Categroy文件夹(这个里面的文件,在这里不详细说明了,有疑问 ...

  6. UITabBarController 基本定制

    UITabBarController 定制 特点 用法 1.准备好你的tabBar图片及其他图片(哈哈哈!!!!),我的图片都放在了Assets.xcassets中. 2.导入本工程中的Categro ...

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

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

  8. 混合使用UITabBarController和UINavigationController

    混合使用这两个控件的好处是我们可以在NavigationBar添加更多的东西,如标题,按钮等.让用户能够获得更多的信息. UITabBarController的属性ViewControllers接受以 ...

  9. 基本组件的使用——UITabBarController

    和UINavigationController的作用差不多,UITabBarController也可以在多个UIViewController中切换 这个控件的使用相对简单,只需要为该控件的viewCo ...

随机推荐

  1. 在Sharepoint2010中发布VS2010开发的WebPart

    转:http://www.cnblogs.com/bfgl/archive/2012/03/22/2411698.html 本人接触Sharepoint2010到今天为止不到一个月.作为一名老C#程序 ...

  2. MongoDB之四( 索引操作)

    我们日常做开发都避免不了要对程序进行性能优化,而程序的操作无非就是CURD,通常我们 又会花费50%的时间在R上面,因为Read操作对用户来说是非常敏感的,处理不好就会被人唾弃,呵呵. 从算法上来说有 ...

  3. maven安装步骤

    第一步:配置maven环境 maven3 安装: 安装 Maven 之前要求先确定你的 JDK 已经安装配置完成.Maven是 Apache 下的一个项目,目前最新版本是 3.0.4,我用的也是这个. ...

  4. oracle执行.sql文件

    ->win+R; ->CMD; ->SQLPLUS /NOLOG; ->CONNECT USER/PASSWORD@ORCL; ->@D:/XXX.SQL;

  5. c++ 派生类向基类转换的可访问性

    对于c++面向对象一直很疑惑,这次决定下功夫把它弄明白 一.派生类和基类之间的类型转换 首先理解,派生类含有基类的所有成分,只不过有些就算在派生类的成员函数也不能访问而已. (1)派生类和基类的自动转 ...

  6. maven,spring,mybatis集成错误

    maven,spring,mybatis集成的时候单元测试junit测试没问题,但mvn jetty:run 就报错误 错误: org.apache.ibatis.binding.BindingExc ...

  7. 算法导论学习-heapsort

    heap的定义:如果数组a[1,....n]满足:a[i]>a[2*i] && a[i]>a[2*i+1],1<=i<=n/2,那么就是一个heap,而且是ma ...

  8. iOS 第三方库冲突的处理

    最近项目组在做一些第三方功能的集成,不止一次的遇到第三方库冲突的问题,报错如下: duplicate symbol _OBJC_METACLASS_$_JKSerializer in: /Users/ ...

  9. 潜语义分析(Latent Semantic Analysis)

    LSI(Latent semantic indexing, 潜语义索引)和LSA(Latent semantic analysis,潜语义分析)这两个名字其实是一回事.我们这里称为LSA. LSA源自 ...

  10. iOS DES 加密转base64

      //用法 加密转base 64 NSString *str = [self base64StringFromText:@"qingjoin" withKey:@"ke ...