一个自定义 UILabel,当文本太大而无法容纳在标签的框架内时,它会淡出文本的末尾

DGFadingLabel

一个自定义 UILabel,当文本太大而无法容纳在标签的框架内时,它会淡出文本的末尾。

Requirements

  • iOS 12.0+
  • Swift 5.5+
  • Xcode 10.0+

Installation

SPM

File > Add Packages > https://github.com/donggyushin/DGFadingLabel

CocoaPod

pod 'DGFadingLabel', :git => 'https://github.com/donggyushin/DGFadingLabel'

Usage

// Usage is same with normal UILabel

let label = DGFadingLabel()
label.text = "Long enough textLong enough textLong enough textLong enough textLong enough textLong enough textLong enough text"

GitHub

点击跳转