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也可以轻松地管理多个控制器,轻松完成控制器之间的切换,典型的例 ...
随机推荐
- SNF开发平台WinForm之四-开发-主细表管理页面-SNF快速开发平台3.3-Spring.Net.Framework
4.1运行效果: 4.2开发实现: 4.2.1 有了第一个程序的开发,代码生成器的配置应该是没有问题了,我们只要在对应的数据库中创建我们需要的表结构就可以了,如下: 主表结构如下: ...
- Apache 配置多端口网站
跳过安装步骤. 1. apache安装目录/conf/httpd.conf,如果你是采用wamp集成环境,那么在 wamp/bin/apache下. 2. 在httpd.conf中,找到 #LoadM ...
- js替换指定字符串
// var a = "212"; // var b = []; // for(var i=0;i<a.length;i++){ // if(a[i]=="1&qu ...
- java模拟一个简单的QQ
v 项目源码 https://github.com/hjzgg/java_QQ v 标题效果 package testFour; import java.awt.Color; import ...
- ubuntu14.04 编译安装gcc-5.3.0
最近编译个源码,要求对C++14的支持了,就GCC的编译安装最新的5.3.0,整个过程以root用户进行. 1.下载GCC源码,属于事后文档整理,已经不知道从哪下载了. 2.解压:tar -zxvf ...
- [OpenCV] Feature Matching
得到了杂乱无章的特征点后,要筛选出好的特征点,也就是good matches. BruteForceMatcher FlannBasedMatcher 两者的区别:http://yangshen998 ...
- SharePoint 2013 搜索爬网功能
最近在政府部门介绍SharePoint 2013 新功能,我也准备了很多,比如SharePoint 2013的Search.以后有机会谈谈Office Web App,Workflow等. Share ...
- Tools - 常用搜索引擎命令
site 用来查询网站收录量. 比如site:http://www.cnblogs.com/ inurl 查URL中包含的元素,比如inurl:bbs ,搜索出URL包含bbs的页面. 常用的inur ...
- Android学习笔记之使用LBS实现定位
PS:最近一直在搞使用LBS实现定位.一般现在涉及到日常生活交易平台的app.貌似都需要使用定位.比如说美团外卖,我请客等app. 学习内容: 1.LBS定位的简单介绍. 2.在Map上添加地图覆盖物 ...
- JS&CSS文件请求合并及压缩处理研究(二)
上篇交待了一些理论方面的东西,并给出了另外一种解决方案的处理流程.本篇将根据该处理流程,开始代码方面的编写工作. 1,打开VS,新建ASP.NET MVC Web项目,项目类型选择空.名称为 Mcmu ...