博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[翻译] VBFPopFlatButton
阅读量:4356 次
发布时间:2019-06-07

本文共 3562 字,大约阅读时间需要 11 分钟。

VBFPopFlatButton

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

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

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

//Exampleself.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

//Exampleself.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 linebuttonAddType,                 // +buttonMinusType,               // -buttonCloseType,               // xbuttonBackType,                // 
buttonMenuType, // 3horizontal linesbuttonDownloadType,buttonShareType,buttonDownBasicType,buttonUpBasicType,buttonDownArrowType,buttonPausedType,buttonRightTriangleType,buttonLeftTriangleType,buttonUpTriangleType,buttonDownTriangleType,buttonOKType,buttonRewindType,buttonFastForwardType,buttonSquareType};

More types are welcomed :D

For more info, visit my blog 

 

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 :)

 

转载于:https://www.cnblogs.com/YouXianMing/p/4625572.html

你可能感兴趣的文章
springboot实现邮件发送
查看>>
Python3.x:抢票
查看>>
前端三大主流框架的对比React、Vue、Angular 所谓是是三分天下
查看>>
SLAM入门之视觉里程计(6):相机标定 张正友经典标定法详解
查看>>
从开发消费者变成开发生产服务者
查看>>
玩转html5(三)---智能表单(form),使排版更加方便
查看>>
JavaSE-17 泛型
查看>>
net core静态文件 访问除默认目录文件配置
查看>>
mysql—数据库优化——如何选择合适的索引
查看>>
数据库基础
查看>>
百度地图API示例之添加自定义控件
查看>>
计时器
查看>>
Spring学习笔记——Spring MVC表单控制器(SimpleFormController)
查看>>
c++学习笔记之函数重载和模板理解
查看>>
完美世界笔试题-递增子序列B-最长递增子序列打印
查看>>
ImageView实现适屏和裁剪图片功能
查看>>
iOS开发--1.对runtime的理解和整理
查看>>
清除浮动 -- 具有兼容性
查看>>
CF778D Parquet Re-laying 构造
查看>>
SpringMVC如何接收application/json内容编码类型的参数?
查看>>