一个Label展示不同字体字符串

转自:http://www.jianshu.com/p/71489b66b0c3
NSMutableAttributedString * title = [[NSMutableAttributedString alloc] initWithString:@"报名号:"];
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;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 字体属性设置示例:if(color ==nil) {color = [NSColor redColor];}NSF...
    袏扌戒指阅读 12,643评论 0 2
  • 转载:http://blog.csdn.net/u010330109/article/details/518821...
    F麦子阅读 9,690评论 0 3
  • 与NSString类似,在iOS中AttributedString也分为NSAttributedString和 N...
    钱十六阅读 4,296评论 0 0
  • 文/吴晓黎 当消息没有回复 问候没有反应 也许对方正忙 也许你的关怀只是打扰 好多时候 犯贱地对人好 掏心掏肺投其...
    吉佳呖呖阅读 1,634评论 9 5
  • 前言: 因为前面讲个那3个demo都是local topology运行,所以对storm集群状态下的工作情况没有介...
    hello_coke阅读 6,340评论 0 3

友情链接更多精彩内容