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也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例 ...
随机推荐
- 基于jQuery点击加载动画按钮特效
分享一款基于jQuery点击加载动画按钮特效.这是一款基于jQuery+CSS3实现的鼠标点击按钮加载动画特效代码.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div ...
- 受限玻尔兹曼机(RBM)学习笔记(六)对比散度算法
去年 6 月份写的博文<Yusuke Sugomori 的 C 语言 Deep Learning 程序解读>是囫囵吞枣地读完一个关于 DBN 算法的开源代码后的笔记,当时对其中涉及的算 ...
- 链表中倒数第k个结点
题目: 输入一个链表,输出该链表中倒数第k个结点. 思路: 因为是单向链表,如果使用最普通的遍历来解决的话会多出很多不必要的遍历.有一个比较好的解法,设置两个指针两个指针之间差k-1个位置,也就是当后 ...
- Android学习笔记之蓝牙通信...
PS:最近同学问我蓝牙的事,因此自己也就脑补了一下蓝牙... 学习内容: 1.如何实现蓝牙通信技术... 蓝牙通信其实是手机里很常用的一种通信方式,现在的手机中是必然存在蓝牙的,蓝牙通信也是有一部 ...
- JS魔法堂:精确判断IE的文档模式by特征嗅探
一.前言 苦逼的前端攻城狮都深受浏览器兼容之苦,再完成每一项功能前都要左顾右盼,生怕浏览器不支持某个API,生怕原生API内含臭虫因此判断浏览器类型和版本号成了不可绕过的一道关卡,而特征嗅探是继浏览器 ...
- mysql如何修改所有的definer
mysql中的definer是什么,有什么作用? 我们在mysql创建view.trigger.function.procedure.event时都会定义一个Definer=‘xxx’,类似如下: C ...
- SqlDataReader、SqlDataAdapter與SqlCommand的 区别
1.SqlDataReader,在线应用,需要conn.open(),使用完之后要关闭. SqlConnection conn = new SqlConnection(connStr); //conn ...
- TortoiseSVN中出现的图标问题及解决方法
1.红色感叹号表示这个文件从服务器上下载下来以后,在本地被修改过.这时执行提交操作就可以了.2.黄色感叹号表示这个文件在提交的时候发现存在冲突,也就是说有别人在你提交之前对这个文件的同一个版本进行了修 ...
- Orchard 异常
在Orchard项目中碰的各种错误整理 1 打开网站出现404 . 查看日志 日志位置Orchard.Web\App_Data\Logs\orchard-error-2016.03.23.log 错误 ...
- Interlocked.CompareExchange
class SourceManager { private SourceManager() { } private static SourceManager sourceManager; public ...