1. 将UILabel控件的Text属性设为Attributed
2. 在viewDidLoad方法中添加如下语句:
NSDictionary *underlineAttribute = @{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)}; lbPrivacy.attributedText = [[NSAttributedString alloc] initWithString:@"隐私政策" attributes:underlineAttribute];
Done.
时间: 2024-10-07 08:53:29