VBFPopFlatButton 0.0.7

VBFPopFlatButton 0.0.7

测试已测试
语言编程语言 Obj-CObjective C
许可证 MIT
发布时间最新版本2016年6月

Victor Baro 维护。



  • Victor Baro

Build Status

使用 pop 实现了 21 种不同状态和 2 种类型的动画的平面按钮。

以下是两种类型在不同状态下的示例

Examples

您在这里可以看到它们的动画效果

ButtonDribbble

使用方法

最好的方法是使用 Cocoapods

pod 'VBFPopFlatButton'

您也可以克隆并打开示例项目。您需要使用的类是 VBFPopFlatButton(UIButton 的子类)。您还可以找到一个名为 VBFDoubleSegment 的辅助类。

下面有一些如何使用按钮的示例代码

平面圆润风格

//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];

平面平面风格

//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];

在 0.0.5 版本中添加的请求功能 指定的初始化器已更改为

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

添加最后一个 'animateToInitialState' 布尔值。发送 YES,按钮将像旧版本(在 viewWillAppear 上从原始类型动画到您 initial 类型,表示为竖线。发送 NO,按钮将不带动画显示为初始类型。

在任何情况下,您都可以使用以下方法从一种状态动画到另一种状态

[flatRoundedButton animateToType:nextType];

这些是按钮可用的 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
};

欢迎更多类型 :D

更多详情,请访问我的博客 victorbaro.com

使用此控件的应用

我很想知道哪些应用在 App Store 中使用此控件。请随时添加您自己的应用 :)