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

 

目录
相关文章
|
搜索推荐
如何系统地学习IT技术:一篇指导初学者和有经验专业人士的博客
如何系统地学习IT技术:一篇指导初学者和有经验专业人士的博客
|
存储 弹性计算 安全
阿里云云计算 ACP 认证(1)|学习笔记(二)
快速学习阿里云云计算 ACP 认证(1)
阿里云云计算 ACP 认证(1)|学习笔记(二)
Python小白需掌握的10个知识点
Python小白需掌握的10个知识点
全网首发:编译链接错误:对‘vtable for xxxx’未定义的引用
全网首发:编译链接错误:对‘vtable for xxxx’未定义的引用
339 0
|
C# 虚拟化 缓存
WPF 列表虚拟化时的滚动方式
ListBox的滚动方式 分为像素滚动和列表项滚动 通过ListBox的附加属性ScrollViewer.CanContentScroll来设置。因此ListBox的默认模板中,含有ScrollViewer,ScrollViewer下存放列表内容  而CanContentScroll,true支持逻辑单元(Item),false支持物理单元(像素)。
1374 0
|
Android开发 数据格式 XML
Android项目实战(三十二):圆角对话框Dialog
前言:   项目中多处用到对话框,用系统对话框太难看,就自己写一个自定义对话框。         对话框包括:1、圆角         2、app图标 , 提示文本,关闭对话框的"确定"按钮   难点:1、对话框边框圆角显示      2、考虑到提示文本字数不确定,在不影响美观的情况下,需要在一行内显示提示的文字信息        3、设置对话框的宽和高   技术储备:      1、安卓开发_使用AlertDialog实现对话框    知道AlertDialog有setView(view) ,Dialog 有ContentView(view) 方法。
1129 0
海绵图
#include #include void tria(xa,ya,xb,yb,xc,yc,n)int xa,ya,xb,yb,xc,yc,n;{  int xp,yp,xq,yq,xr,yr;  if (n>0)  {    xp=(xa+xb)/2;   yp=(ya+yb)/2;    xq=...
643 0
|
15天前
|
存储 人工智能 弹性计算
阿里云弹性计算_加速计算专场精华概览 | 2024云栖大会回顾
2024年9月19-21日,2024云栖大会在杭州云栖小镇举行,阿里云智能集团资深技术专家、异构计算产品技术负责人王超等多位产品、技术专家,共同带来了题为《AI Infra的前沿技术与应用实践》的专场session。本次专场重点介绍了阿里云AI Infra 产品架构与技术能力,及用户如何使用阿里云灵骏产品进行AI大模型开发、训练和应用。围绕当下大模型训练和推理的技术难点,专家们分享了如何在阿里云上实现稳定、高效、经济的大模型训练,并通过多个客户案例展示了云上大模型训练的显著优势。