一個(gè)Label展示不同字體字符串

轉(zhuǎn)自:http://www.itdecent.cn/p/71489b66b0c3
NSMutableAttributedString * title = [[NSMutableAttributedString alloc] initWithString:@"報(bào)名號(hào):"];
NSDictionary * titleAttributes = @{ NSFontAttributeName:[UIFont jk_systemFontOfPxSize:34],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],};
[title setAttributes:titleAttributes range:NSMakeRange(0,title.length)];

NSMutableAttributedString * number = [[NSMutableAttributedString alloc] initWithString:@"204370534"];
NSDictionary * numberAttributes = @{NSFontAttributeName:[UIFont jk_systemFontOfPxSize:40],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"],};
[number setAttributes:numberAttributes range:NSMakeRange(0,number.length)];

[title appendAttributedString:number];

registerMumberLabel.attributedText = title;
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 字體屬性設(shè)置示例:if(color ==nil) {color = [NSColor redColor];}NSF...
    袏扌戒指閱讀 8,498評(píng)論 0 2
  • 轉(zhuǎn)載:http://blog.csdn.net/u010330109/article/details/518821...
    F麥子閱讀 4,321評(píng)論 0 3
  • 與NSString類(lèi)似,在iOS中AttributedString也分為NSAttributedString和 N...
    錢(qián)十六閱讀 904評(píng)論 0 0
  • 文/吳曉黎 當(dāng)消息沒(méi)有回復(fù) 問(wèn)候沒(méi)有反應(yīng) 也許對(duì)方正忙 也許你的關(guān)懷只是打擾 好多時(shí)候 犯賤地對(duì)人好 掏心掏肺投其...
    吉佳嚦嚦閱讀 251評(píng)論 9 5
  • 前言: 因?yàn)榍懊嬷v個(gè)那3個(gè)demo都是local topology運(yùn)行,所以對(duì)storm集群狀態(tài)下的工作情況沒(méi)有介...
    hello_coke閱讀 2,170評(píng)論 0 3

友情鏈接更多精彩內(nèi)容