[翻译] VBFPopFlatButton

时间:2022-12-16 16:18:05

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:

以下是示例显示:

[翻译] VBFPopFlatButton

And here you can see them animated:

以下是动画示例:

[翻译] VBFPopFlatButton

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

[翻译] VBFPopFlatButton的更多相关文章

  1. 《Django By Example》第五章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:大家好,我是新来的翻译, ...

  2. 《Django By Example》第四章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:祝大家新年快乐,这次带来<D ...

  3. &lbrack;翻译&rsqb;开发文档:android Bitmap的高效使用

    内容概述 本文内容来自开发文档"Traning > Displaying Bitmaps Efficiently",包括大尺寸Bitmap的高效加载,图片的异步加载和数据缓存 ...

  4. 【探索】机器指令翻译成 JavaScript

    前言 前些时候研究脚本混淆时,打算先学一些「程序流程」相关的概念.为了不因太枯燥而放弃,决定想一个有趣的案例,可以边探索边学. 于是想了一个话题:尝试将机器指令 1:1 翻译 成 JavaScript ...

  5. 《Django By Example》第三章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:第三章滚烫出炉,大家请不要吐槽文中 ...

  6. 《Django By Example》第二章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:翻译完第一章后,发现翻译第二章的速 ...

  7. 《Django By Example》第一章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者注:本人目前在杭州某家互联网公司工作, ...

  8. 【翻译】Awesome R资源大全中文版来了,全球最火的R工具包一网打尽,超过300&plus;工具,还在等什么?

    0.前言 虽然很早就知道R被微软收购,也很早知道R在统计分析处理方面很强大,开始一直没有行动过...直到 直到12月初在微软技术大会,看到我软的工程师演示R的使用,我就震惊了,然后最近在网上到处了解和 ...

  9. ASP&period;NET MVC with Entity Framework and CSS一书翻译系列文章之第一章:创建基本的MVC Web站点

    在这一章中,我们将学习如何使用基架快速搭建和运行一个简单的Microsoft ASP.NET MVC Web站点.在我们马上投入学习和编码之前,我们首先了解一些有关ASP.NET MVC和Entity ...

随机推荐

  1. 转 Android 4&period;0后,自定义Title报错 You cannot combine custom titles with other title feature

      自定义Titlebar时为了避免冲突 需要修改:AndroidManifest.xml android:theme="@style/mystyle" styles.xml文件中 ...

  2. Android 查看内存

    文章参照自:http://*.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-a ...

  3. 看文章《EAI和SOA的比较》有感&lpar;1&rpar;

    <EAI和SOA的比较>http://www.cnblogs.com/asdling/archive/2007/11/26/973100.html这篇文章写的很全面,至少自己这么认为,也解 ...

  4. Hibernate制图(两)——许多-于&HorizontalLine;关系映射

    上篇学习了Hibernate的基本映射,也就是单表映射,非常easy就能理解,可是对于关系数据库来说,表之间存在关系是比不可少的.关系数据库中存在的关系是通过主外键建立起来的.反应到Hibernate ...

  5. &lpar;╭ ̄3 ̄&rpar;╭ 小希的迷宫II

    (╭ ̄3 ̄)╭ 小希的迷宫II TimeLimit: 2000/1000 MS (Java/Others)  MenoryLimit: 65536/32768 K (Java/Others) 64-b ...

  6. WebStorm2018破解

    参考网站http://www.sdbeta.com/wg/2018/0302/220048.html修改整理如下: webstorm 2018.1正式版破解summary jetbrainscrack ...

  7. css和HTML布局小技巧

    一:水平居中 1. 如下所示,让child在parent中水平居中 <!DOCTYPE html> <html> <head lang="en"&gt ...

  8. quartz定时任务的简单使用

    开发环境: springmvc quartz-2.2.3在官网下载的. 步骤: 1.首先在web.xml中加入以下代码: <servlet> <servlet-name>Qua ...

  9. JavaScript 之 DOM

    1. DOM DOM:Document Object Model 文档对象模型,定义访问和操作结构化文档(HTML)的方式. 在 HTML DOM (Document Object Model) 中 ...

  10. &lbrack;leetcode&rsqb;8&period; String to Integer &lpar;atoi&rpar;字符串转整数

    Implement atoi which converts a string to an integer. The function first discards as many whitespace ...