我已经使用网站(http://fontastic.me/),它给你.ttf文件创建了一些图标字体。创建IBInspectable的Unicode字符
您可以通过
myLable.text = "\u{e002}" //
print("\u{e002}") //
print("\u{1F496}") //
这个作品很好使用它,但我想直接用故事板传递字符串。
然后我开始使用UILabel子类并为unicode字符串创建@IBInsectable。但这不起作用。以下是IBInspectable的代码。
@IBInspectable internal var myString: String? {
didSet {
text = "\u{e002}" // this works
text = "\\u{\(myString)}" //\u{e002} this not
}
或
let myString = "e002"
print("\\u{\(myString)}") //\u{e002}
连这个也没有工作
print(myString)
text = String(UTF8String: myString!)
但这只会打印文本它假设打印图标像print("\u{e002}")
这一点。 如何解决这个问题,我错过了什么?
在此先感谢您的帮助。
非常感谢你。 –
乐于助人,快乐编码。 –