CLTypingLabel
iOS UILabel with character by character typing /typewriter animation
Install / Use
/learn @cl7/CLTypingLabelREADME
CLTypingLabel
<img src="https://travis-ci.org/travis-ci/travis-web.svg?branch=master">
<img src="https://raw.githubusercontent.com/l800891/CLTypingLabel/master/Assets/demogiff.gif" width=320>
A lightweight UILabel subclass with character by character typewriter like animation in Swift, super simple to use
iOS上自带逐字打印动画效果的UILabel
Installation
Manual
- Copy and paste <a href="https://github.com/l800891/CLTypingLabel/blob/master/Pod/Classes/CLTypingLabel.swift">CLTypingLabel.swift</a> to your xcode project.
CocoaPods
- Install the latest release of CocoaPods:
gem install cocoapods - Add this line to your Podfile:
pod 'CLTypingLabel' - Install the pod:
pod install
Usage
- Change the class of a label from UILabel to CLTypingLabel;
Sample Code
@IBOutlet weak var myTypeWriterLabel: CLTypingLabel!
At runtime, set text of the label will trigger animation automatically:
myTypeWriterLabel.text = "This is a demo of typing label animation..."
You can also trigger what you need after animation is finished:
myTypeWriterLabel.onTypingAnimationFinished = {
//code goes here
}
Also works on attributedText:
myTypeWriterLabel.attributedText = NSAttributedString(string: "This is an attributed text typing animation...", attributes: attr)
You can pause the typing animation at any time:
myTypeWriterLabel.pauseTyping() //this will pause the typing animation
myTypeWriterLabel.continueTyping() //this will continue paused typing animation
And customize time interval between each character:
myTypeWriterLabel.charInterval = 0.08 //optional, default is 0.1
License
This code is distributed under the terms and conditions of the MIT license.
Related Skills
node-connect
336.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.8kCommit, push, and open a PR
