SparkImageView 2.1.4

SparkImageView 2.1.4

测试已测试
Lang语言 SwiftSwift
许可证 MIT
Released最后发布2017年4月
SwiftSwift 版本3.0
SPM支持 SPM

Alex Steiner 维护。



  • Alex Steiner

SparkImageView

用 Swift 编写的最喜欢的动态按钮

preview

需求

  • iOS 8.0+
  • Xcode 7.3

安装

对于手动安装,将源文件夹拖动到您的项目中。

对于使用 CocoaPods,请将此行添加到您的 Podfile

pod 'FaveButton', '~> 2.1'

使用

与 storyboard 或 xib 文件一起使用

  1. 创建一个继承自 FaveButton 的按钮

  2. Normal 状态添加图像

  3. IBOutlet 委托属性设置为 FaveButtonDelegate 的子类

  4. 可选 通过操纵属性来更改按钮设置

@IBInspectable public var dotFirstColor:   UIColor
@IBInspectable public var dotSecondColor:  UIColor
@IBInspectable public var circleFromColor: UIColor
@IBInspectable public var circleToColor:   UIColor

在代码中

需要稍后添加。

操纵点颜色

如果您想要不同的点颜色,如 Twitter 的心动动画,则使用您想要按钮的委托方法。

func faveButtonDotColors(_ faveButton: FaveButton) -> [DotColors]?{
    if faveButton == myFaveButton{
        // return dot colors
  }
    return nil
}

FaveButtonDemo 中,您可以找到一组导致点以这种方式出现的颜色

preview

鸣谢

FaveButton 吸收了 Twitter 在他们的 应用 中使用的 Like Heart Animation 的灵感。

许可证

FaveButton 在 MIT 许可证下发布。