iOS 小技巧总结

iOS 小技巧总结_第1张图片

 

代码版本:

1  NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"点击注册代表您已经同意我们的《用户协议》"];
2     NSRange strRange = {14,6};
3     [str addAttribute:NSForegroundColorAttributeName value:[UIColor colorInSkinWithKey:@"useColor1"] range:strRange];  //设置颜色
4     [str addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:strRange];
5 
6 //因为是   NSMutableAttributedString  所以要使用
7 
8 [_radioButton setAttributedTitle:str forState:UIControlStateNormal];

 

你可能感兴趣的:(iOS 小技巧总结)