UITabBarController 初学
纯代码编写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 初学的更多相关文章
- 移动开发:初学 iOS-UIViewController 心得
初学 iOS,本文翻译了一些 iOS 官网上的 UIViewController 的知识点,如有不到位或不正确的地方,还请指正: 本文所介绍的内容的目标: 理解content view control ...
- DDD初学指南
去年就打算总结一下,结果新换的工作特别忙,就迟迟没有认真动手.主要内容是很多初学DDD甚至于学习很长时间的同学没有弄明白DDD是什么,适合什么情况.这世界上没有银弹,抛开了适合的场景孤立的去研究DDD ...
- gulp初学
原文地址:gulp初学 至于gulp与grunt的区别,用过的人都略知一二,总的来说就是2点: 1.gulp的gulpfile.js 配置简单而且更容易阅读和维护.之所以如此,是因为它们的工作方式不 ...
- 初学seaJs模块化开发,利用grunt打包,减少http请求
原文地址:初学seaJs模块化开发,利用grunt打包,减少http请求 未压缩合并的演示地址:demo2 学习seaJs的模块化开发,适合对seajs基础有所了解的同学看,目录结构 js — —di ...
- UITabBarController 升级定制
UITabBarController 定制 特点 用法 1.准备工作: 加入你的相关图片,放入了Assets.xcassets; 导入Categroy文件夹(这个里面的文件,在这里不详细说明了,有疑问 ...
- UITabBarController 基本定制
UITabBarController 定制 特点 用法 1.准备好你的tabBar图片及其他图片(哈哈哈!!!!),我的图片都放在了Assets.xcassets中. 2.导入本工程中的Categro ...
- 自定义UITabBarController标签视图控制器
首先创建一个类,继承自UItabBarController 然后在.m文件中: 这里我有两个宏定义: #define WIDTH (myView.frame.size.width / 4) //我在写 ...
- 混合使用UITabBarController和UINavigationController
混合使用这两个控件的好处是我们可以在NavigationBar添加更多的东西,如标题,按钮等.让用户能够获得更多的信息. UITabBarController的属性ViewControllers接受以 ...
- 基本组件的使用——UITabBarController
和UINavigationController的作用差不多,UITabBarController也可以在多个UIViewController中切换 这个控件的使用相对简单,只需要为该控件的viewCo ...
随机推荐
- JAX-WS(JWS)发布WebService
WebService历来都很受重视,特别是Java阵营,WebService框架和技术层出不穷.知名的XFile(新的如CXF).Axis1.Axis2等. 而Sun公司也不甘落后,从早期的JAX-R ...
- kafka的安装和使用
简单说kafka是一个高吞吐的分部式消息系统,并且提供了持久化. kafka的架构 • producer:消息生存者• consumer:消息消费者• broker:kafka集群的server,负责 ...
- Git提交引用和引用日志
转载自:https://github.com/geeeeeeeeek/git-recipes/wiki/5.5-Git%E6%8F%90%E4%BA%A4%E5%BC%95%E7%94%A8%E5%9 ...
- Storm系列(十六)架构分析之Executor-Bolt
准备消息循环的数据 函数原型: 1 let[executor-sampler (mk-stats-sampler (:storm-conf executor-data))] 主要功能: 定义tupl ...
- HW4.37
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...
- Lua包管理工具Luarocks详解 - 15134559390的个人空间 - 开源中国社区
Lua包管理工具Luarocks详解 - 15134559390的个人空间 - 开源中国社区 Lua包管理工具Luarocks详解
- php tcp socket 学习汇总
推荐实例:PHP socket 深入浅出讲解:php的socket通信 基于socket.io的实时消息推送 php socket通信(tcp/udp) PHP向socket服务器收发数据 php实现 ...
- 跟我一起写Makefile:MakeFile介绍
makefile 介绍 make命令执行时,需要一个 makefile 文件,以告诉make命令如何去编译和链接程序. 首先,我们用一个示例来说明makefile的书写规则.以便给大家一个感性认识.这 ...
- android图片闪烁或帧动画
remote_recording_transition.xml 文件 <?xml version="1.0" encoding="utf-8"?> ...
- (贪心5.1.1)POJ 1230 Pass-Muraille
/* * POJ_1230.cpp * * Created on: 2013年10月9日 * Author: Administrator */ #include <iostream> #i ...