测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2017年12月 |
SwiftSwift 版本 | echo "4.0" > .swift-version |
SPM支持 SPM | ✗ |
由 Rimh-(Ming) 维护。
一个简单的针对 UITextView 和 UILabel 的打字动画。
XCode 9.1, Swift 4.0, iOS 8 或更高版本
简单地输入文本(不换行)。
带自动换行的打字。
RimhTypingLetters 可通过 CocoaPods 使用。要安装它,只需在 Podfile 添加以下行
pod 'RimhTypingLetters'
首先,您需要导入模块。
import RimhTypingLetters
对于 TextView
@IBOutlet weak var textview:TypingLetterUITextView!
// You can specific delimiter to wrap the content such as a space.
textview.typeText(message, delimiter: " ", typingSpeedPerChar: 0.05, didResetContent: true) {
// complete action after finished typing
}
// By default: delimiter = nil (no-wrapping), typingSpeedPerChar = 0.04, didResetContent = true.
textview.typeText(message) {
// complete action after finished typing
}
对于 Label
// Extension function in UILabel is similar to TypingLetterUITextView's function, just only delimiter parameter is not exist.
label.typeText(message, typingSpeedPerChar: 0.1, didResetContent = true, completeCallback:{
// complete action after finished typing
}
如果您想自定义功能,您可以创建子类。
class MyTextView:TypingLetterUITextView {
override func updateTypingTextView(_ character: Character) {
super.updateTypingTextView(character)
}
}
RimhTypingLetters 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。