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

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

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

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

Done.

posted @ 2014-10-23 17:58  GreatK  阅读(555)  评论(0编辑  收藏  举报