ThenMorphingLabel 0.0.1

ThenMorphingLabel 0.0.1

ghost 维护。



  • 作者
  • ghost

ThenMorphingLabel

是从 LTMorphingLabel 分支出来的。

Swift 编写的 morphing UILabel 子类。.Scale 效果模仿了 Apple's QuickType animation of iOS 8 of WWDC 2014。还包括作为 Swift 扩展的新 morphing 效果。

enum ThenMorphingLabel.Effect: Int, Printable

.Scale - 默认

LTMorphingLabel

.Evaporate

LTMorphingLabel-Evaporate

.Fall

LTMorphingLabel-Fall

.Pixelate

LTMorphingLabel-Pixelate

.Sparkle

LTMorphingLabel-Sparkle

.Sparkle 是在 QuartzCore.CAEmitterLayer 的基础上构建的。还有一个基于 SpriteKit 的版本,请参阅 此处

.Burn

LTMorphingLabel-Burn

.Anvil

LTMorphingLabel-Anvil

SwiftUI

public var body: some View {
    VStack {
        MorphingText(
            "Awesome Morphing Text",
            effect: .evaporate,
            font: UIFont.systemFont(ofSize: 20),
            textColor: .black,
            textAlignment: .center
        ).frame(maxWidth: 200, maxHeight: 100)
        ...

需求

  1. iOS 11.0+

安装

Swift 包管理器

  1. 文件 > Swift 包 > 添加包依赖
  2. 复制并粘贴 https://github.com/ghostcrying/ThenMorphingLabel,然后按照指示操作

Carthage

  1. 将此行添加到您的 Cartfile 中:github "ghostcrying/ThenMorphingLabel"
  2. 阅读官方说明

CocoaPods

  1. 安装 CocoaPods 的最新版本:gem install cocoapods
  2. 将此行添加到您的 Podfile 中:pod 'LTMorphingLabel'
  3. 安装 pod:pod install

用法

  1. 将 label 的类从 UILabel 改为 LTMorphingLabel;
  2. 通过代码设置一个新的 String 到它的 text 属性。
  3. 要交互式地使用,在更改 .text 属性后调用 .pause(),并使用 updateProgress(progress: Float) 交互式地更新进度。