测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布上次发布 | 2017年1月 |
SwiftSwift版本 | 3.0 |
SPM支持SPM | ✗ |
由Ridvan Kucuk维护。
UIImageViewWithWords库是用Swift编写的,它可以让你创建带有单词首字母的图像。创建UIImageView对象后,你只需要一行代码!
这将向您的UIImageView对象添加一个带有随机背景色的圆形首字母图像。
imageView.imageWithString(word: "Ridvan Kucuk")
或者您可以设置您喜欢的颜色(默认为圆形)
imageView.imageWithString(word: "Ridvan Kucuk", color: UIColor.blueColor())
或者如果您不想它是圆形的,您只需设置圆形为false
imageView.imageWithString(word: "Ridvan Kucuk", circular: false)
或者如果您想设置所有偏好,您可以使用这个
imageView.imageWithString(word: "Ridvan Kucuk", color: nil, circular: true)
或者如果您想给文本添加属性,您可以设置属性如下
let fontAttributes = [NSForegroundColorAttributeName : UIColor.blueColor(),
NSFontAttributeName : UIFont.systemFontOfSize(40)
]
self.imageView.imageWithString(word: "Ridvan Kucuk", color: UIColor.orangeColor(), circular: true, fontAttributes: fontAttributes)
您只需将UIImageView+Words.swift文件拖放到您的项目中即可。
Ridvan Kucuk,[email protected]
UIImageViewWithWords可在MIT许可证下获得。有关更多信息,请参阅LICENSE文件。