[翻译] 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
Robert Dimitrov
@robbdimitrov
转载于:https://www.cnblogs.com/YouXianMing/p/4166416.html
[翻译] RDVTabBarController相关推荐
- Mysql函数group_concat、find_in_set 多值分隔字符字段进行数据库字段值翻译
Mysql函数group_concat.find_in_set进行数据库字段值翻译 场景 配方表:记录包含的原料 sources表示原料,字段值之间用逗号分隔 原料表:对应原料id和原料名称 现需要查 ...
- “Attention is All You Need 翻译
<p><img src="output_0_0.png" alt="png"></p> "Attention is ...
- 基于PyTorch的Seq2Seq翻译模型详细注释介绍(一)
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/qysh123/article/deta ...
- 全文翻译(全文合集):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning
全文翻译(全文合集):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 摘要 人们越来越需要将机器学习应用到各种各样 ...
- 全文翻译(四) TVM An Automated End-to-End Optimizing Compiler
全文翻译(四) TVM An Automated End-to-End Optimizing Compiler 6.3 嵌入式GPU评估 对于移动GPU实验,在配备ARM Mali-T860MP4 G ...
- 全文翻译(三) TVM An Automated End-to-End Optimizing Compiler
全文翻译(三) TVM An Automated End-to-End Optimizing Compiler 5. 自动化优化 考虑到一组丰富的调度原语,剩下的问题是为DL模型的每一层,找到最佳的算 ...
- 全文翻译(二): TVM: An Automated End-to-End Optimizing Compiler for Deep Learning
全文翻译(二): TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 3.优化计算图 计算图是在DL框架中表示程序的常 ...
- 全文翻译(一):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning
全文翻译(一):TVM: An Automated End-to-End Optimizing Compiler for Deep Learning 摘要 人们越来越需要将机器学习应用到各种各样的硬件 ...
- YOLOv4全文阅读(全文中文翻译)
YOLOv4全文阅读(全文中文翻译) YOLOv4: Optimal Speed and Accuracy of Object Detection 论文链接: https://arxiv.org/pd ...
最新文章
- 数据输出:如何将数据带给页面||SpringMVC除过在方法上传入原生的request和session外还能怎么样把数据带给页面
- 28. Leetcode 25. K 个一组翻转链表 (链表-反转链表)
- Java io流学习总结(三)
- 潘正磊:再过三五年 AI会变成开发人员的基本概念
- AIX操作系统基本命令
- 注册域名需要资格吗_域名对于企业商标注册的重要性你知道吗?
- 微软私有云分享(R2)24 审核WDS部署
- zend studio代码自动提示问题,有的提示正常有的提示不正常,解决方法
- 代理服务器好帮手--SOCKS2HTTP
- html解决页面放大后元素乱排的问题
- 2021年7月整理--简单方法 暴力破解WIFI密码
- 3dmax烘焙贴图主要设置之Flatiron
- HttpClient4.x使用中出现的几个问题及解决方法
- python应该怎么样自学_Python该如何自学?
- c语言标志位flag怎么用,怎么用flag标志位当单片机中断标志来用
- HDU-6441-Find Integer-费马大定理+奇偶数列法则
- 百分制成绩转换五分制F【Python习题】(保姆级图文+实现代码)
- linux 使用 nginx 搭建 zookeeper 集群
- 差分信号经运放后转为单端输出供单片机采集原理图
- iOS 清理某一个cookies 或者全部 cookies
热门文章
- 查询已有链表的hashmap_面试官再问你 HashMap 底层原理,就把这篇文章甩给他看...
- java tostring的用处_JAVA的tostring()方法的作用是什么呢?
- matlab变参传函,什么是传递函数的增益
- 带权并查集-Building Block
- java调用打印机打印需要进行什么操作_Java调用打印机程序有什么特点?
- Web前端期末大作业--汽车主题网页设计002(HTML+CSS+JavaScript+)实现
- flash 火狐总是崩溃_win10系统火狐flash插件总是崩溃的解决方法
- linux svn 服务器下载,Linux下搭建SVN服务器完全手册
- vue 根据swagger 生成接口_采用vue编写的功能强大的swagger-ui页面
- Redis流水线性能提高