[翻译] 极具动感的 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(分布式拒绝服务)攻击指借助于客户/服务器技术,将多个计算机联合起来作为攻击平台,对一 ...
随机推荐
- HTML标签列表总览
超文本标记语言(简称:HTML)标记标签通常被称为HTML标签,HTML标签是HTML语言中最基本的单位,HTML标签是HTML(标准通用标记语言下的一个应用)最重要的组成部分.HTML标签的大小写无 ...
- hdu 4349 求C(n,0),C(n,1),C(n,2)...C(n,n).当中有多少个奇数 (Lucas定理推广)
Lucas定理:把n写成p进制a[n]a[n-1]a[n-2]...a[0],把m写成p进制b[n]b[n-1]b[n-2]...b[0],则C(n,m)与C(a[n],b[n])*C(a[n-1], ...
- CF 586A 找1的个数和101的个数
Sample test(s) input 50 1 0 1 1 output 4 input 71 0 1 0 0 1 0 output 4 input 10 output 0 # include & ...
- 【POJ】1704.Georgia and Bob
题解 感觉挺神奇的 我们把石子从后往前相邻的两个两两配对,这样他们之间的空格就相当于一堆石子 而配对后左边棋子移动,右边棋子也一定可以跟上取 转化成简单的nim游戏,最后只要看转化出的这(N - 1) ...
- 2017冬季24集训模拟-2.A问题
————————————————————————————————————————题解 唯一没有想出来的题 我们发现以上两种操作 a0,a3,a6,a9……的相对位置不变 a1,a4,a7,a10……的 ...
- 8-3 4Values Whose Sum is Zero 和为0的四个值
给定四个n元素集合 ABCD 要求分别从中取一个元素 abcd 使得他们的合为0 问有多少中取法 map果然炸了 #include<bits/stdc++.h> using n ...
- GTK, GTK+, Qt, KDE, GNOME, Unity的区别与联系
GTK,GTK+, Qt是图形界面开发库(GUI Toolkit),用户可以使用这些开发库编写GUI应用,其中GTK+是GTK的升级版. KDE,GNOME,Unity是linux下的桌面环境(Des ...
- sql find duplicate
SELECT GUID, COUNT(*) FROM xx GROUP BY GUID HAVING COUNT(*) > 1; SELECT name, email, COUNT(*) FRO ...
- Xamarin 2017.11.1更新
Xamarin 2017.11.1更新 本次更新主要解决了一些bug.Visual Studio 2017升级到15.4.2获得新功能.Visual Studio 2015需要工具-选项-Xamar ...
- Revit二次开发示例:DeleteObject
在本例中,通过命令可以删除选中的元素. 需要注意的是要在代码中加入Transaction,否则的话会出现Modifying is forbidden because the document has ...
