测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT许可证 |
发布最后发布 | 2015年5月 |
SPM支持SPM | ✗ |
由 Danilo Bürger 和 Freeletics 维护。
FLTextView 向 UITextView 添加占位符,就像 UITextField 原生提供的那样。与其他类似库相比,我们允许根据占位符的大小调整塗鴉視窗(UITextView)区域的高度或内容大小。
下载 FLTextView 并尝试 iPhone 示例应用程序。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'FLTextView/Legacy', '~> 1.0'
CocoaPods 仅支持 iOS 8.0+ 部署目标的 Swift 代码文件。这就是为什么在您安装了库之后,您必须手动将文件夹 Pods/FLTextView/FLTextView
作为组包含在 Xcode 项目中。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'FLTextView', '~> 1.0'
编辑 Podfile 后,请运行以下命令:
$ pod install
您可以通过 Interface Builder 配置 FLTextView(请参阅示例),或使用如下方法:
let textView = FLTextView(frame: CGRectZero, textContainer: nil)
textView.placeholder = "ClapClap"
textView.placeholderTextColor = UIColor.lightGrayColor()
也支持属性文本
let placeholder = NSMutableAttributedString(string: "No excuses")
placeholder.addAttribute(NSForegroundColorAttributeName, value: UIColor(white: 0.7, alpha: 1.0), range: NSMakeRange(0, 10))
placeholder.addAttribute(NSStrikethroughStyleAttributeName, value: NSUnderlineStyle.StyleDouble.rawValue, range: NSMakeRange(3, 7))
placeholder.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.StyleSingle.rawValue, range: NSMakeRange(0, 2))
textView.attributedPlaceholder = placeholder
FLTextView 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。