Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cl7/cltypinglabel
iOS UILabel with character by character typing /typewriter animation
https://github.com/cl7/cltypinglabel
animation character cocoapods ios ios-uilabel swift swift-4 swift4 swift5 typing-animation typing-effect uikit uilabel
Last synced: 13 days ago
JSON representation
iOS UILabel with character by character typing /typewriter animation
- Host: GitHub
- URL: https://github.com/cl7/cltypinglabel
- Owner: cl7
- License: mit
- Created: 2016-02-21T20:55:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-13T00:13:51.000Z (over 4 years ago)
- Last Synced: 2024-10-13T14:41:08.481Z (about 1 month ago)
- Topics: animation, character, cocoapods, ios, ios-uilabel, swift, swift-4, swift4, swift5, typing-animation, typing-effect, uikit, uilabel
- Language: Swift
- Homepage: https://cocoapods.org/pods/CLTypingLabel
- Size: 867 KB
- Stars: 327
- Watchers: 4
- Forks: 54
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CLTypingLabel ![Language](https://img.shields.io/badge/iOS-Swift5-orange.svg)
A lightweight UILabel subclass with character by character typewriter like animation in Swift, super simple to use
iOS上自带逐字打印动画效果的UILabel
## Installation
### Manual
0. Copy and paste CLTypingLabel.swift to your xcode project.
### [CocoaPods](https://cocoapods.org/pods/CLTypingLabel)
1. Install the latest release of CocoaPods: `gem install cocoapods`
2. Add this line to your Podfile: `pod 'CLTypingLabel'`
3. Install the pod: `pod install`## Usage
1. Change the class of a label from UILabel to CLTypingLabel;
2. Programmatically set the .text property of your CLTypingLabel to a new String. The animation will be triggered automatically.## Sample Code
```swift
@IBOutlet weak var myTypeWriterLabel: CLTypingLabel!
```
At runtime, set text of the label will trigger animation automatically:
```swift
myTypeWriterLabel.text = "This is a demo of typing label animation..."```
You can also trigger what you need after animation is finished:
```swift
myTypeWriterLabel.onTypingAnimationFinished = {
//code goes here
}
```
Also works on attributedText:
```swift
myTypeWriterLabel.attributedText = NSAttributedString(string: "This is an attributed text typing animation...", attributes: attr)```
You can pause the typing animation at any time:
```swift
myTypeWriterLabel.pauseTyping() //this will pause the typing animation
myTypeWriterLabel.continueTyping() //this will continue paused typing animation
```
And customize time interval between each character:
```swift
myTypeWriterLabel.charInterval = 0.08 //optional, default is 0.1
```## License
This code is distributed under the terms and conditions of the MIT license.