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 selectedBackgroundunselectedBackground 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

Robert Dimitrov
@robbdimitrov

[翻译] RDVTabBarController的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. [翻译]开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300+工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. Fiddler 502问题

    使用Fiddler的时候遇到下面这个问题:在地址栏想打开个一般处理程序,出现连接本机失败的提示,如下图: 而这在我没打开Fiddler的时候是显示正常的. 查看Fiddler,在嗅探 -> 第二 ...

  2. Kafka消息重新发送

    Kafka消息重新发送   1.  使用kafka消息队列做消息的发布.订阅,如果consumer端消费出问题,导致数据并没有消费,此时不需要担心,数据并不会立刻丢失,kafka会把数据在服务器的磁盘 ...

  3. SSL虚拟主机安全方案

    SSL虚拟主机安全方案 随着虚拟主机技术的发展,功能越来越丰富,已经不仅仅只是满足个人网站的需要,越来越多的小型电子商务网站也采用了虚拟主机来建站,如何为这些商户提供经济.方便的SSL解决方案,成为虚 ...

  4. 尝试用selenium+appium运行一个简单的demo报错:could not get xcode version. /Library/Developer/Info.plist doest not exist on disk

    业余时间抽空搭了个appium+selenium的环境(mac), 在执行第一个脚本的时候遇到个问题纪录下: could not get xcode version. /Library/Develop ...

  5. solr 6.6 基础环境搭建 (一)

    Apache Solr 介绍 参考博主原文链接1:http://www.cnblogs.com/blueskyli/p/7100443.html 参考博主原文链接2:http://www.cnblog ...

  6. bind9配置转发服务

    修改bind主配置文件 $ vi /etc/named.conf//// named.conf//// Provided by Red Hat bind package to configure th ...

  7. chrome 等浏览器不支持本地ajax请求的问题

    chrome 等浏览器不支持本地ajax请求的问题 XMLHttpRequest cannot load file:///D:/WWW/angularlx/ui-router-test/templat ...

  8. datatable 转excel

    public static void ExportToExcel(System.Data.DataTable dt) { if (dt == null) return; Microsoft.Offic ...

  9. Javascript数组操作函数总结

    (1) shift  删除原数组第一项,并返回删除元素的值:如果数组为空则返回undefined var a = [1,2,3,4,5]; var b = a.shift(); //a:[2,3,4, ...

  10. 使用phpQuery轻松采集网页内容

    phpQuery是一个基于PHP的服务端开源项目,它可以让PHP开发人员轻松处理DOM文档内容,比如获取某新闻网站的头条信息.更有意思的是,它采用了jQuery的思想,你可以像使用jQuery一样处理 ...