TTAnimationButton 0.1.1

TTAnimationButton 0.1.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布时间上次发布2017年6月

liuty 维护。



  • 作者:
  • liuty

一个具有类似 Twitter 按钮的美丽选中动画的生动按钮。

支持使用 UIButton setImage:forState:自定义图像形状。

安装

TTAnimationButton 可在 CocoaPods 上获取。只需将其添加到您的项目 Podfile 中即可

pod 'TTAnimationButton'

使用

如同 UIButton 一样使用

TTAnimationButton *button = [TTAnimationButton buttonWithType:UIButtonTypeCustom];
button.explosionRate = 100;
[button setImage:[UIImage imageNamed:@"heart"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
[button sizeToFit];

属性

/**
 *  Set button selected image color, default red.
 */
@property (nonatomic, strong) UIColor *imageSelectedColor;

/**
 *  Set button normal image color, default lightGray.
 */
@property (nonatomic, strong) UIColor *imageNormalColor;

/**
 *  Explosion density, higher leads more particles, default 0 with no explosion.
 */
@property (nonatomic, assign) NSInteger explosionRate;

/**
 *  YES to allow customize image size, set before setting image, default NO.
 */
@property (nonatomic, assign) BOOL enableCustomImageSize;

/**
 *  YES to disable the animation, default NO.
 */
@property (nonatomic, assign) BOOL disableAnimation;