[翻译] 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 ...
随机推荐
- tomcat启动(五)Catalina分析-service.init
上篇写到StandardService.init() 这个方法做什么呢?一起来看看. 这个类也是实现了Lifecycle 如图.这个图中i表示Interface接口.如Lifecycle,Contai ...
- NAS DAS SAN 磁带机 tco
部分摘录自: 百科:http://baike.baidu.com/link?url=7HOH3pJHfaxT-a01T0EhTZBnvvfMoyOZTthUbjMQM85LVxwfFP47YInuo1 ...
- [日常] nginx访问频率限制
去年的事,随便记记 ========================================================================= 2017年3月15日 记录: n ...
- Spark of work
Today I attended a meeting of reviewing code, and I learned a lot from it. In the discuss, we found ...
- ASP.NET Core 2 学习笔记(十二)REST-Like API
Restful几乎已算是API设计的标准,通过HTTP Method区分新增(Create).查询(Read).修改(Update)和删除(Delete),简称CRUD四种数据存取方式,简约又直接的风 ...
- K8S基础概念
一.核心概念 1.Node Node作为集群中的工作节点,运行真正的应用程序,在Node上Kubernetes管理的最小运行单元是Pod.Node上运行着Kubernetes的Kubelet.kube ...
- csharp:获取 DNS、网关、子网掩码、IP
/// <summary> /// DNS.网关.子网掩码.IP /// 涂聚文 2015 /// </summary> public class IPAddressStrin ...
- 利用css3制作毛玻璃的效果
忙里偷闲,最近又在看许多比较酷炫的效果.现在基于jquery的插件比较多,但是很多插件的兼容性不是太好,所以原生的才是王道.在日常当中,毛玻璃已经不常见了,那是一个很久远年代的东西了.诺,下面就是毛玻 ...
- PHP网站(Drupal7)响应过慢之“Wating(TTFB)时间过长”
直接上图: 这是Chrome浏览器自带的工具分析的.整个url请求的时间为2.59秒,最大的耗时在Wating(TTFB, Time To First Byte),消耗了2.59秒(应该是其他时间太短 ...
- 安装php扩展redis (windows环境)
首先十分感谢网络上支持开源分享的前辈们,资源真的太丰富了,虽然也有许多优秀的国外资源被墙了... 想要给php增加redis扩展第一步当然要知道自己使用的php版本以及一些配置.查看 phpinfo ...