码迷,mamicode.com
首页 > 移动开发 > 详细

iOS: 两句话给UILabel添加下划线

时间:2014-10-23 19:09:36      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   ar   sp   div   

1. 将UILabel控件的Text属性设为Attributed

bubuko.com,布布扣

2. 在viewDidLoad方法中添加如下语句:

NSDictionary *underlineAttribute = @{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)};
lbPrivacy.attributedText = [[NSAttributedString alloc] initWithString:@"隐私政策"
                                                             attributes:underlineAttribute];

Done.

iOS: 两句话给UILabel添加下划线

标签:style   blog   http   color   io   os   ar   sp   div   

原文地址:http://www.cnblogs.com/ilovewindy/p/4046439.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!