简体   繁体   English

如何自定义UILabel以显示图像?

[英]How can i customize UILabel for image display?

I want to customize UILabel control. 我想自定义UILabel控件。

For example, 例如,

lblName.text = @"Zotiger";

then label shows Zotiger normally. 然后标签正常显示Zotiger。

And if i set its text with some special characters (in my case, * is a special character for replacing with image) 如果我将其文本设置为一些特殊字符(在我的情况下,*是用于替换图像的特殊字符)

lblName.text = @"***";
lblPhone.text =  @"***-****-****";

then label shows three icons as below image. 然后标签显示三个图标,如下图所示。

星空文字将被替换为爱情图标

How can i customize UILabel simply? 如何简单地自定义UILabel? Is there any open source control? 是否有任何开源控件?

its simple, you can use certain Unicode characters in your string, and the iPhone will display them as Emoji 很简单,您可以在字符串中使用某些Unicode字符,iPhone会将其显示为表情符号

see this link for heart unicode 看到这个链接的心脏unicode

in your case for red heart : \ 对于您的红色心脏: \

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM