第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在UILabel中嵌入小圖標

如何在UILabel中嵌入小圖標

智慧大石 2019-12-09 14:00:59
我需要UILabel在iOS7中嵌入一些小圖標(自定義項目符號)。如何在界面設計器中執(zhí)行此操作?或至少在代碼中?在Android中有l(wèi)eftDrawable和rightDrawable用于標簽,但是在iOS中如何實現(xiàn)?
查看完整描述

3 回答

?
holdtom

TA貢獻1805條經驗 獲得超10個贊

您可以使用iOS 7的文本附件(屬于TextKit的一部分)來執(zhí)行此操作。一些示例代碼:


NSTextAttachment *attachment = [[NSTextAttachment alloc] init];

attachment.image = [UIImage imageNamed:@"MyIcon.png"];


NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];


NSMutableAttributedString *myString= [[NSMutableAttributedString alloc] initWithString:@"My label text"];

[myString appendAttributedString:attachmentString];


myLabel.attributedText = myString;


查看完整回答
反對 回復 2019-12-09
  • 3 回答
  • 0 關注
  • 1053 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號