RSFloatInputView
特性
- 使用 CoreText 为平滑动画
- 支持可选左侧图标
- 支持可选分隔符
- 可配置填充、大小、字体和颜色
- 适用于多种风格
- 适用于字符串本地化
- 支持在界面构建器中配置
示例
定制化
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
RSFloatInputView.stringTransformer = {
orginal in
// Transform the place holder string configured in XIB with your own way.
// e.g return NSLocalizedString(orginal, comment: orginal)
return orginal.replacingOccurrences(of: "TXT_", with: "")
}
RSFloatInputView.instanceTransformer = {
instance in
// Support multi-styles in one place using the tag
if instance.tag == 0 {
instance.floatPlaceHolderColor = UIColor.brown
instance.textColor = UIColor.darkText
instance.tintColor = UIColor.brown
}
if instance.tag == 1 {
instance.floatPlaceHolderColor = UIColor.blue
instance.textColor = UIColor.darkText
instance.tintColor = UIColor.blue
}
}
return true
}
要求
- iOS 8.0
- Swift 4.1
安装
RSFloatInputView 通过 CocoaPods 提供。要安装它,只需在您的 Podfile 中添加以下行
pod "RSFloatInputView"
作者
Roy Ng, [邮箱 保护] @ Redso, https://www.redso.com.hk/
LinkedIn: https://www.linkedin.com/in/roy-ng-19427735/
许可
RSFloatInputView 采用 MIT 许可。有关更多信息,请参阅 LICENSE 文件。