[翻译] 极具动感的 FRDLivelyButton
FRDLivelyButton
https://github.com/sebastienwindal/FRDLivelyButton
FRDLivelyButton is a simple UIButton subclass intended to be used inside a UIBarButtonItem, even though it can be used anywhere you can use a UIButton. It is entirely Core Graphics driven, supports 5 common button types (menu, close, add, etc...) used in navigation bar, and will nicely animate any button type changes and touch events.
FRDLivelyButton 是一个 UIButton 的子类,其设计的目的是用在 UIBarButtonItem 中的,当然呢,它也可以在其他地方当做一个 UIButton 使用。它完全是由 Core Graphics 绘制的,支持5种按钮类型(菜单、关闭、添加等),通常情况下它是用在导航栏上的,而且,在导航栏上,点击这个按钮时会生成一个很好看的动画变化效果。

Requirements
FRDLivelyButton uses ARC and requires iOS 6.1+.
FRDLivelyButton 使用ARC,需要iOS 6.1+
Installation
CocoaPods
pod 'FRDLivelyButton', '~> 1.1.2'
Manual
Copy the folder FRDLivelyButton to your project.
将文件夹 FRDLivelyButton 复制到你的项目中去。
Usage
Add a FRDLivelyButton either in code or using interface builder.
直接使用 FRDLivelyButton 实例化对象或者是用 IB 来实例化。
Example, how to add a FRDLivelyButton in a nav bar:
例如,如何添加 FRDLivelyButton 到导航栏上:
FRDLivelyButton *button = [[FRDLivelyButton alloc] initWithFrame:CGRectMake(0,0,36,28)];
[button setStyle:kFRDLivelyButtonStyleHamburger animated:NO];
[button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.rightBarButtonItem = buttonItem;
To change the button style, just call setStyle:animated:
点击时改变按钮的样式,调用 setStyle:animated: 即可。
[self.myButton setStyle:kFRDLivelyButtonStyleCircleClose animated:YES];
The current type of the button can be accessed using the buttonStyle property:
当前按钮的类型是可以通过属性 buttonStyle 来获取的:
- (IBAction)buttonAction:(FRDLivelyButton *)sender
{
if (sender.buttonStyle == kFRDLivelyButtonStylePlus) {
// logic
} else ....
}
Customizing Appearance
Button appearance and behavior can be customized using an options NSDictionary. Color, highlighted color, line thickness, animation durations, etc... can be customized. Default should work just fine though.
按钮的样式是可以通过字典来定义的。颜色、高亮颜色、线条粗细、动画时长等等,都可以定制,实际上默认值本身就够好了。
See FRDLivelyButton.h for list of possible attributes.
在 FRDLivelyButton.h 文件中查看那些可以修改的属性吧。
Example:
[button setOptions:@{ kFRDLivelyButtonLineWidth: @(2.0f),
kFRDLivelyButtonHighlightedColor: [UIColor colorWithRed:0.5 green:0.8 blue:1.0 alpha:1.0],
kFRDLivelyButtonColor: [UIColor blueColor]
}];
[翻译] 极具动感的 FRDLivelyButton的更多相关文章
- 9款极具创意的HTML5/CSS3进度条动画(免积分下载)
尊重原创,原文地址:http://www.cnblogs.com/html5tricks/p/3622918.html 免积分打包下载地址:http://download.csdn.net/detai ...
- 9款极具创意的HTML5/CSS3进度条动画
今天我们要分享9款极具创意的HTML5/CSS3进度条动画,这些进度条也许可以帮你增强用户交互和提高用户体验,喜欢的朋友就收藏了吧. 1.HTML5/CSS3图片加载进度条 可切换多主题 今天要分享的 ...
- jQuery+css3实现极具创意的罗盘旋转时钟效果源码
效果 HTML代码 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...
- 8款极具表现力的jQuery/CSS3网页菜单
上一篇我向大家分享了7款效果震憾的HTML5应用组件,今天主要来分享一下CSS3网页菜单,因为在一个网站中,菜单起着举足轻重的作用,所以作为WEB开发人员,我们有必要将网站的菜单设计得尽量完美,下面向 ...
- 分享9款极具创意的HTML5/CSS3进度条动画
1.HTML5/CSS3图片加载进度条 可切换多主题 今天要分享的这款HTML5/CSS3进度条模拟了真实的图片加载场景,插件会默认去从服务器下载几张比较大的图片,然后让该进度条展现当前读取图片的进度 ...
- 极具性价比优势的工业控制以及物联网解决方案-米尔MYD-C8MMX开发板测评
今天要进行测评的板子是来自米尔电子的MYD-C8MMX开发板.MYD-C8MMX开发板是米尔电子基于恩智浦,i.MX 8M Mini系列嵌入式应用处理器设计的开发套件,具有超强性能.工业级应用.10年 ...
- 带你了解极具弹性的Spark架构的原理
摘要:相比MapReduce僵化的Map与Reduce分阶段计算相比,Spark的计算框架更加富有弹性和灵活性,运行性能更佳. 本文分享自华为云社区<Spark架构原理>,作者:JavaE ...
- 推荐6款极具个性化的在线生成logo的网站
http://www.douban.com/group/topic/10434724/
- 29.极具破坏力的DDoS:浅析其攻击及防御
一.DDoS的概念 1.什么是“DDoS”? DDoS:Distributed Denial of Service(分布式拒绝服务)攻击指借助于客户/服务器技术,将多个计算机联合起来作为攻击平台,对一 ...
随机推荐
- Ansible常见模块介绍
本节内容: ansible命令基础 常见模块举例 一.ansible命令基础 语法: ansible <host-pattern> [-f forks] [-m module_name] ...
- day9--回顾
线程 vs 进程 进程:一堆资源集的集合.线程:操作系统能够调度的最小单位. 进程和线程的谁快是误区,进程至少包含一个线程,是没有可比性的. 线程:共享内存,两个线程同时操作一个数据,要加锁.全 ...
- React.js学习之环境搭建
1 工欲善其事必先利其器:前端开发工具 1.1 WebStorm和Sublime Text Sublime Text:作为代码编辑器,Sublime Text的优点如下: 主流前端开发编辑器 体积较小 ...
- Jquery~跨域异步上传文件
先说明白 这个跨域异步上传功能我们借助了Jquery.form插件,它在异步表单方面很有成效,而跨域我们会在HTTP响应头上添加access-control-allow-method,当然这个头标记只 ...
- Ionic Js十一:模态
ionicModal 可以遮住用户主界面的内容框. 你可以在你的 index 文件或者是其他文件内嵌入以下代码(里面的代码可以根据你自己的业务场景相应的改变). <script id=" ...
- Ionic入门四:卡片
近年来卡片(card)的应用越来越流行,卡片提供了一个更好组织信息展示的工具. 针对移动端的应用,卡片会根据屏幕大小自适应大小. 我们可以很灵活的控制卡片的显示效果,甚至实现动画效果. 卡片一般放在页 ...
- [leetcode greedy]45. Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the arra ...
- 1036 Boys vs Girls (25)(25 point(s))
problem This time you are asked to tell the difference between the lowest grade of all the male stud ...
- Javascript中call方法和apply方法用法和区别
第一次在博客园上面写博客,知识因为看书的时候发现了一些有意思的知识,顺便查了一下资料,就发到博客上来了,希望对大家有点帮助. 连续几天阅读<javascript高级程序设计>这本书了,逐渐 ...
- python2.7 关于打印中文的各种方法
目录 str类型的中文 第一种姿势:逐个打印 第二种姿势: json dumps 第三种姿势: repr string_escape 第四种姿势:PEP3140 unicode类型的中文 当str与u ...
