[翻译] RDVTabBarController
RDVTabBarController

https://github.com/robbdimitrov/RDVTabBarController
效果:

- Supports iPad and iPhone 支持iPad与iPhone
- Supports landscape and portrait orientations 支持横竖屏切换动画
- Can be used inside UINavigationController 可以用在UINavigationController里面
- Customizable badges 可定制的提示标签
Installation 安装
CocoaPods - cocoaPods
If you're using CocoaPods, simply add pod 'RDVTabBarController' to your Podfile.
如果你使用了CocoaPods,简单的pod ‘RDVTabBarController’ 到你的Podfile文件中就行了。
Drag & Drop - 拖到项目当中
Add the items from RDVTabBarController directory to your project. If you don't have ARC enabled, you will need to set a -fobjc-arc compiler flag on the .m source files.
直接将RDVTabBarController文件夹拖到你的项目当中。如果你的项目是MRC的,你需要在.m文件里面设置-fobjc-arc编译标签。
Example Usage - 使用示例
Initialize RDVTabBarController
初始化RDVTabBarController
The initialization is similar to the one for UITabBarController. Create an instance of the tabBarController and initialize its viewControllers.
初始化方法与UITabBarController类似,创建一个tabBarController的实例以及初始化控制器。
UIViewController *firstViewController = [[RDVFirstViewController alloc] init];
UIViewController *firstNavigationController = [[UINavigationController alloc]
initWithRootViewController:firstViewController]; UIViewController *secondViewController = [[RDVSecondViewController alloc] init];
UIViewController *secondNavigationController = [[UINavigationController alloc]
initWithRootViewController:secondViewController]; UIViewController *thirdViewController = [[RDVThirdViewController alloc] init];
UIViewController *thirdNavigationController = [[UINavigationController alloc]
initWithRootViewController:thirdViewController]; RDVTabBarController *tabBarController = [[RDVTabBarController alloc] init];
[tabBarController setViewControllers:@[firstNavigationController, secondNavigationController,
thirdNavigationController]];
self.viewController = tabBarController;
Customize RDVTabBarController - 定制RDVTabBarController
Each RDVTabBarItem has selectedBackground, unselectedBackground and corresponding properties for the icons: selectedImage and unselectedImage.
每一个RDVTabBarItem都有选择被背景与未选择的背景,或者是对应于选择的图片与未选择的图片。
UIImage *finishedImage = [UIImage imageNamed:@"tabbar_selected_background"];
UIImage *unfinishedImage = [UIImage imageNamed:@"tabbar_normal_background"];
NSArray *tabBarItemImages = @[@"first", @"second", @"third"]; RDVTabBar *tabBar = [tabBarController tabBar]; [tabBar setFrame:CGRectMake(CGRectGetMinX(tabBar.frame), CGRectGetMinY(tabBar.frame), CGRectGetWidth(tabBar.frame), 63)]; NSInteger index = 0;
for (RDVTabBarItem *item in [[tabBarController tabBar] items]) {
[item setBackgroundSelectedImage:finishedImage withUnselectedImage:unfinishedImage];
UIImage *selectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",
[tabBarItemImages objectAtIndex:index]]];
UIImage *unselectedimage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_normal",
[tabBarItemImages objectAtIndex:index]]];
[item setFinishedSelectedImage:selectedimage withFinishedUnselectedImage:unselectedimage]; index++;
}
Make the tab bar translucent - 可以让tab bar变得半透明
RDVTabBar has translucent property which determines how it is going to be handled.
RDVTabBar有着半透明色这个属性,他决定着怎么个透明方式。
RDVTabBar *tabBar = tabBarController.tabBar; // After the tabBarController initialization
tabBar.translucent = YES; // Customize the tabBar background
tabBar.backgroundView.backgroundColor = [UIColor colorWithRed:245/255.0
green:245/255.0
blue:245/255.0
alpha:0.9]]; // Inside the tabbed viewControllers
- (void)viewDidLoad {
[super viewDidLoad]; ... if (self.rdv_tabBarController.tabBar.translucent) {
CGFloat tabBarHeight = CGRectGetHeight(self.rdv_tabBarController.tabBar.frame);
UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, tabBarHeight, 0); self.tableView.contentInset = insets;
self.tableView.scrollIndicatorInsets = insets;
}
}
Requirements - 需要的环境
- ARC
- iOS 5.0 or later
- Xcode 5
Contact
[翻译] RDVTabBarController的更多相关文章
- 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...
- 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...
- [翻译]开发文档:android Bitmap的高效使用
内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...
- 【探索】机器指令翻译成 JavaScript
前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...
- 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...
- 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...
- 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)
书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...
- 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?
0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点
在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...
随机推荐
- 使用httpClient处理get请求或post请求
另外一个版本: http://www.cnblogs.com/wenbronk/p/6671928.html 在java代码中调用http请求, 并将返回的参数进行处理 get请求: public s ...
- curl的head小记
CURLINFO_HEADER_OUT,如果启用会在curl_getinfo里得到发送的头信息 CURLINFO_HEADER 如果启用,会在结果里返回回应的消息头信息
- java面试④数据库部分
2.3.1 数据库的分类及常用的数据库 数据库分为:关系型数据库和非关系型数据库 关系数据库:mysql,oracle,sqlServer 非关系型:redis,mongoDB 2.3.2 简单介绍一 ...
- Core中使用Hangfire
之前使用Quartz.Net,后来发现hangfire对Core的继承更加的好,而且自带管理后台,这就比前者好用太多了. 安装注册 安装 PM> Install-Package Hangfire ...
- 国际化实现之安装脚手架vue以及打包问题
做这个项目用的是vue+element UI来实现的响应式布局,现主要说一下国际化这块的实现. 第一步:新建文件夹i18n 第二步:配置cn.js.en.js等文件内容 cn.js import en ...
- haml参考大全
原文来自: http://blackanger.blog.51cto.com/140924/47642 Haml是一种用来描述任何XHTML web document的标记语言,它是干净,简单的. ...
- Hadoop提交作业流程
一 .需要知道的内容 1.ResourceManager ------>yarn的老大 2.NodeManager ------>yarn的小弟 3.ResourceMana ...
- C# using用法
一.using指令 使用using指令在文件顶部引入命名空间,如 using System; using System.IO; 二.using别名 用using为命名空间或类型定义别名,当引入的多个命 ...
- Golang 并发Groutine详解
概述 1.并行和并发 并行(parallel):指在同一时刻,有多条指令在多个处理器上同时执行. 并发(concurrency):指在同一时刻只能有一条指令执行,但多个进程指令被快速的轮换执行,使得在 ...
- [转载]常见的移动端H5页面开发遇到的坑和解决办法
转过来,平时看看.虽然还有很多问题至今无解.比如:华为麒麟950的P8和meta打开我们的应用首页经常偶发白屏.!! 1.安卓浏览器看背景图片,有些设备会模糊. 用同等比例的图片在PC机上很清楚,但是 ...