UITabBarController 微信
AppDelegate.m
#import "AppDelegate.h"
#import "FirstViewController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
#import "FourthViewController.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch. // 第一步:创建window
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible]; // 第二步:创建UITabBarController对象
UITabBarController *mainTab = [[UITabBarController alloc] init];
//mainTab.tabBar.barTintColor = [UIColor purpleColor];
mainTab.tabBar.tintColor = [UIColor colorWithRed: / 255.0 green: / 255.0 blue: alpha:]; // 第三步:设置window的根控制器
self.window.rootViewController = mainTab; // 第四步:设置UITabBarController的控制器数组
// 4.1 创建导航控制器并制定导航控制器的根视图
UINavigationController *firstNav = [[UINavigationController alloc] initWithRootViewController:[[FirstViewController alloc] init]]; UINavigationController *secondNav = [[UINavigationController alloc] initWithRootViewController:[[SecondViewController alloc] init]]; UINavigationController *thirdNav = [[UINavigationController alloc] initWithRootViewController:[[ThirdViewController alloc] init]]; UINavigationController *fourthNav = [[UINavigationController alloc] initWithRootViewController:[[FourthViewController alloc] init]]; // 4.2 设置导航控制器的TabBarItem
UIImage *img1 = [UIImage imageNamed:@"tabbar_mainframe@3x"];
UIImage *imgS1 = [[UIImage imageNamed:@"tabbar_mainframeHL@3x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; // 设置选中的图片保留图片原有的样式,不进行渲染 UIImage *img2 = [UIImage imageNamed:@"tabbar_contacts@3x"];
UIImage *imgS2 = [[UIImage imageNamed:@"tabbar_contactsHL@3x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UIImage *img3 = [UIImage imageNamed:@"tabbar_discover@3x"];
UIImage *imgS3 = [[UIImage imageNamed:@"tabbar_discoverHL@3x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; UIImage *img4 = [UIImage imageNamed:@"tabbar_me@3x"];
UIImage *imgS4 = [[UIImage imageNamed:@"tabbar_meHL@3x"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; firstNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"微信" image:img1 selectedImage:imgS1];
secondNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"通讯录" image:img2 selectedImage:imgS2];
thirdNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"发现" image:img3 selectedImage:imgS3];
fourthNav.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"我" image:img4 selectedImage:imgS4]; // 4.3 将导航控制器对象添加到数组中
//[mainTab addChildViewController:firstNav];
mainTab.viewControllers = @[firstNav, secondNav, thirdNav, fourthNav]; #pragma mark - UIAppearance // 一键设置
[UINavigationBar appearance].barTintColor = [UIColor blackColor]; [UINavigationBar appearance].barStyle = UIBarStyleBlack; [UINavigationBar appearance].tintColor = [UIColor whiteColor]; // 同理,也有,但是只有一个tabbar,没必要而已
// [UITabBar appearance] return YES;
} @end
FirstViewController.m
#import "FirstViewController.h"
#import "Test1ViewController.h" @interface FirstViewController () @end @implementation FirstViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view. self.title = @"微信";
self.navigationController.navigationBar.barTintColor = [UIColor blackColor]; // [self.navigationController.navigationBar setBackgroundImage:<#(nullable UIImage *)#> forBarMetrics:<#(UIBarMetrics)#>] // 修改title的颜色和大小
// [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : [UIFont systemFontOfSize:20]}]; // 设置barstyle修改状态栏(简单,可以用)
// self.navigationController.navigationBar.barStyle = UIBarStyleBlack; // 添加右按钮
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(click:)]; } - (void)click:(UIBarButtonItem *)sender { Test1ViewController *test1VC = [[Test1ViewController alloc] init]; // 设置push隐藏tabbar
test1VC.hidesBottomBarWhenPushed = YES; [self.navigationController pushViewController:test1VC animated:YES];
} @end
UITabBarController 微信的更多相关文章
- iOS开发UI篇—UITabBarController简单介绍
iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavigationController类似,UITabBarControlle ...
- [BS-09] UITabBarController简单介绍
iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavigationController类似,UITabBarControlle ...
- iOS - UITabBarController
前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBarController : UIViewController <UITabBarDelegate ...
- ios基础篇(八)——UITabBarController的简单介绍
一.简介 UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例子就 ...
- 转 UITabBarController简单介绍
文顶顶 iOS开发UI篇—UITabBarController简单介绍 iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavi ...
- 和iPhone有关的视图控制器:UIViewController、UITabBarController、UINavigationController及其混合用法
iPhone中的view视图是应用程序对于数据最直观.最直接的呈现方式,如下是我在学习了iPhone中的视图控制器以及由其衍生的特殊子类的总结,希望对那些初学者有所帮助: UIViewControll ...
- [iOS基础控件 - 6.12.1] QQ菜单管理 UITabBarController 控制器管理
A.需求 1.类似QQ.微信顶部或者底部的窗口转换导航条 2.给每个页面添加相应内容 B.UITabBarController 1.基本概念: (1)内容高度 iOS7之前内容高度为:屏幕高度 - ...
- 复习知识点:TabBarViewController(微信框架)
TabBarViewController:标签视图控制器 在application设置 创建四个视图控制器 引入视图控制器头文件 #import "AppDelegate.h" # ...
- 文顶顶 iOS开发UI篇—UITabBarController简单介绍 iOS开发UI篇—UITabBarController简单介绍
一.简单介绍 UITabBarController和UINavigationController类似,UITabBarController也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例 ...
随机推荐
- Git 文件比较
Git 的三个作业场: 工作区(Work Tree) 项目根目录下 .git 目录以外所有区域,是编辑项目文件的地方. 缓存区(Index) 工作区文件必须先保存在缓存区,之后从缓存区保存到仓库. 仓 ...
- Javascript倒计时组件new TimeSpan(hours, minutes, minutes)
function TimeSpan(h, m, s) { this.h = Number(h); this.m = Number(m); this.s = Number(s); } TimeSpan. ...
- 正确理解静态Static关键字
与其他语言不通,C#没有全局变量和全局函数的感念,C#的所有字段和方法都出现在一个类的上下文中,在C#中与全局字段或函数等价的就是静态字段或方法.“全局字段或方法”与“C#的静态字段或方法”没有功能上 ...
- 浅谈WeakHashMap
Java WeakHashMap 到底Weak在哪里,它真的很弱吗?WeakHashMap 的适用场景是什么,使用时需要注意些什么?弱引用和强引用对Java GC有什么不同影响?本文将给出清晰而简洁的 ...
- 设计模式--原型(Prototype)模式
写这些也许有人认为“为了模式而模式”.Insus.NET所想到的,每个大师成为大师之前,也许都得这样做. 走路,从小就开始学,直至现在,谁还不是为了走路而走路?一直重复着...... 很多人没有分享自 ...
- 【转】MSMQ 微软消息队列 简单 示例
MSMQ它的实现原理是:消息的发送者把自己想要发送的信息放入一个容器中(我们称之为Message),然后把它保存至一个系统公用空间的消息队列(Message Queue)中:本地或者是异地的消息接收程 ...
- 引入js和css文件的总结
1.用script标签引入javascript时,浏览器对于javascript的加载某些是并行的,某些是串行的,如IE8,Chorme2和firefox3都是串行加载的. 2.charset编码也就 ...
- 【jQuery基础学习】03 jQuery中的事件与动画
关于jQuery中的事件 js与HTML之间的交互是通过用户和浏览器操作页面时引发的事件来处理的. jQuery增加并扩展了基本的事件处理机制,jQuery不仅提供了更加优雅的事件处理方法,而且极大地 ...
- 重新想象 Windows 8.1 Store Apps (91) - 后台任务的新特性: 下载和上传的新特性, 程序启动前预下载网络资源, 后台任务的其它新特性
[源码下载] 重新想象 Windows 8.1 Store Apps (91) - 后台任务的新特性: 下载和上传的新特性, 程序启动前预下载网络资源, 后台任务的其它新特性 作者:webabcd 介 ...
- csharp: Domain-Driven Design(领域驱动设计)
http://dddsample.sourceforge.net/ https://github.com/citerus/dddsample-core http://dddsamplenet.code ...