DWAnimatedLabel 1.2

DWAnimatedLabel 1.2

dywane 维护。




DWAnimatedLabel

一个矢量化 UILabel 子类,允许您使用不同类型进行动画,受 RQShineLabel 启发。

wave

中文教程

特性

  • 继承自 UILabel,易于使用
  • 使用 CADisplayLink 进行平滑动画
  • 四种不同的动画
  • 纯 Swift

typewritter

shine

fade

安装

您想要添加以下类似命令 pod 'DWAnimatedLabel', '~> 1.1' 到您的 Podfile 中

target 'MyApp' do
  pod 'DWAnimatedLabel', '~> 1.1'
end

然后在您的终端中运行 pod install,或者从 CocoaPods.app 运行。

或者要测试运行,运行以下命令

pod try DWAnimatedLabel

使用

您需要导入模块 fire

import DWAnimatedLabel

然后您可以像使用 UILabel 一样创建标签。

let label = DWAnimatedLabel(frame: CGRect(x: 20, y: 44, width: UIScreen.main.bounds.size.width, height: 100))
label.text = "LOADING"
label.font = UIFont.systemFont(ofSize: 70, weight: .bold)

您还可以通过设置 animationType 属性来选择动画类型。

label.animationType = .wave

如果您使用的是 wave 动画,还需要设置 placeHolderColor 属性,否则它将是 UIColor.lightGray

label.placeHolderColor = .blue

设置这些属性后,您可以使用 startAnimation(duration: TimeInterval, _ completion:(() -> Void)?) 启动动画。

需求

  • iOS 9.0+
  • Swift 4
  • Xcode 9

贡献

欢迎您 Fork 并提交 pull 请求或问题。

许可证

DWAnimatedLabel是开源软件,采用MIT许可证。

致谢

DWAnimatedLabel由Dywanedu拥有和维护。