TransitionLabel
TransitionLabel 是一种简单的方法,在同一个 Label 中显示不同的文本。它实现起来非常简单,也很容易修改。您可以使用 Storyboard 或者手动插入标签和值。
如何实现
将 TransitionLabel
添加到代码中,最简单的方法是通过将 UILabel
添加到您的 Storyboard 中,并将它的类更改为 TransitionLabel
您也可以通过代码创建一个 TransitionLabel
,如下所示
let secondTransitionLabel = TransitionLabel(frame: CGRect(origin: position, size: size), labelValues: ["Set", "Of", "Values"], animationDuration: 1.0, shouldLoop: false)`
可配置属性
labelValues: [String?]- An array of strings which will be sequentially displayed as your label text
shouldLoop: Bool (by default, set to true)- This allows the values set to labels repeat from the begining once
animationDuration: Double (by default, set to 3.0)- Tells the Label, how long a value should be shown
示例
要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install
需求
安装
TransitionLabel可通过CocoaPods获取。要安装,只需在Podfile中添加以下行
pod 'TransitionLabel'
作者
Sidharth J Dev, [email protected]
许可证
TransitionLabel在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。