VBFPopFlatButton

简介:

VBFPopFlatButton

https://github.com/victorBaro/VBFPopFlatButton

Flat button with 21 different states and 2 types animated using pop.

Flat button 有21种不同的状态以及两种动画类型,动画用的是 pop 。

These are some examples of both types in different states:

以下是示例显示:

And here you can see them animated:

以下是动画示例:

 

How to use it

Best way is using Cocoapods

pod 'VBFPopFlatButton'

You can also clone and open example project. The class you have to use is VBFPopFlatButton(subclass of UIButton). You will also find VBFDoubleSegment which is just a helping class.

你可以使用Cocoapods,或者是clone到你的电脑中。

Here there is some example code on how to use the button:

以下是使用示例

Flat Rounded Style

//Example
self.flatRoundedButton = [[VBFPopFlatButton alloc]initWithFrame:CGRectMake(100, 150, 30, 30)
                                              buttonType:buttonMenuType
                                             buttonStyle:buttonRoundedStyle
                                             animateToInitialState:YES];
self.flatRoundedButton.roundBackgroundColor = [UIColor whiteColor];
self.flatRoundedButton.lineThickness = 2;
self.flatRoundedButton.tintColor = [UIColor flatPeterRiverColor];
[self.flatRoundedButton addTarget:self
                           action:@selector(flatRoundedButtonPressed)
                 forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.flatRoundedButton];

 

Flat Plain Style

//Example
self.flatPlainButton = [[VBFPopFlatButton alloc]initWithFrame:CGRectMake(200, 150, 30, 30)
                                                   buttonType:buttonAddType
                                                  buttonStyle:buttonPlainStyle
                                                  animateToInitialState:NO];
self.flatPlainButton.lineThickness = 2;
self.flatPlainButton.tintColor = [UIColor whiteColor];
[self.flatPlainButton addTarget:self
                         action:@selector(flatPlainButtonPressed)
               forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.flatPlainButton];

 

Requested feature added on 0.0.5 The designated initializer has changed to:

    - (instancetype)initWithFrame:(CGRect)frame 
                    buttonType:(FlatButtonType)initType 
                   buttonStyle:(FlatButtonStyle)bStyle 
        animateToInitialState:(BOOL)animateToInitialState;  

Adding the last 'animateToInitialState' boolean. Sending YES, the button will perform as in older versions (will animate on viewWillAppear from original type, represented as vertical line, to your initial type). Sending NO, the button will be presented using initial type with no animation on presentation.

In both cases, you can use the following method to animate the button from one state to the next:

[flatRoundedButton animateToType:nextType];

This are the 20 types avaiable for the button:

以下是20种不同的动画类型:

typedef NS_ENUM(NSInteger, FlatButtonType) {
buttonDefaultType,             // Vertical line
buttonAddType,                 // +
buttonMinusType,               // -
buttonCloseType,               // x
buttonBackType,                // <
buttonForwardType,             // >
buttonMenuType,                 // 3horizontal lines
buttonDownloadType,
buttonShareType,
buttonDownBasicType,
buttonUpBasicType,
buttonDownArrowType,
buttonPausedType,
buttonRightTriangleType,
buttonLeftTriangleType,
buttonUpTriangleType,
buttonDownTriangleType,
buttonOKType,
buttonRewindType,
buttonFastForwardType,
buttonSquareType
};

More types are welcomed :D

For more info, visit my blog victorbaro.com

 

Apps using this control

I would love to know which apps in the App Store are using this control. Please, feel free to add your app :)

 

目录
相关文章
|
存储 监控 Linux
zabbix使用snmp监控Linux主机(二十)
使用snmp监控Linux主机 1.snmp协议介绍 SNMP(简单网络管理协议)也是应用层的一种协议,默认端口号为161,我们平时监控Linux主机都是安装一个agent客户端进行监控,但是有的公司还需要监控网络设备和Windows主机,这时就不得不采用snmp协议去监控设备了
865 0
zabbix使用snmp监控Linux主机(二十)
|
4月前
数据传输的基本概念
本内容介绍了带宽、数据传输速率和吞吐量的概念及三者关系。带宽是通信链路的最大传输能力,决定理论上限;数据传输速率表示实际传输速度,受多种因素影响可能低于带宽;吞吐量则是实际测量的传输速率,反映网络真实性能。用公路类比:带宽是宽度(容量)、数据传输速率是速度、吞吐量是实际通行量。
630 7
|
11月前
|
存储 监控 安全
服务器维护是确保服务器稳定运行、数据安全和性能优化的重要过程
【10月更文挑战第4天】服务器维护是确保服务器稳定运行、数据安全和性能优化的重要过程
303 65
|
机器学习/深度学习
机器学习xgboost的用户贷款是否违约进行预测 完整代码数据 计算机毕设
机器学习xgboost的用户贷款是否违约进行预测 完整代码数据 计算机毕设
157 0
|
SQL 数据库 UED
条件筛选大作战:解析Where与Having的区别与应用
条件筛选大作战:解析Where与Having的区别与应用
250 0
|
安全 Shell 开发工具
su 和su - 有何区别?sudo和su有何区别?
在实际工作中,曾经遇到切换用户环境变量无法加载的问题。其原因就是对su 和su -的区别认识有问题。
628 0
|
自然语言处理 安全 AndFix
区块链商城系统开发步骤指南/详细需求/源码功能/多语言/海外版
When developing a blockchain mall system, the following steps and requirements are usually required:
谈一谈|Markdown转为word文档
谈一谈|Markdown转为word文档
517 0
适合撰写课程论文的 LaTeX 模板
适合撰写课程论文的 LaTeX 模板
429 0
|
SQL 机器学习/深度学习 分布式计算
Apache Doris Spark Load快速体验之Spark部署(1)1
Apache Doris Spark Load快速体验之Spark部署(1)1
185 0