如何在Label中顯示圖片

UIImage *image = [UIImage imageNamed:@"321.jpg"];
 
// 1> 生成文本附件
NSTextAttachment *textAttach = [[NSTextAttachment alloc] init];
textAttach.image = image;
 
// 2> 使用文本附件創建屬性文本
NSAttributedString *strA = [NSAttributedString attributedStringWithAttachment:textAttach];
 
self.lblChat.attributedText = strA;
發佈了40 篇原創文章 · 獲贊 1 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章