微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iOS 6中如何下划线?

我试图在标签中强调一些文字.但是,我不知道如何获取标签中整个文本的范围.这是我到目前为止
NSMutableAttributedString *mat = [self.tableLabel.attributedText mutablecopy];
[mat addAttributes:@{NSUnderlinestyleAttributeName: @(NSUnderlinestyleSingle)} range://??];
self.tableLabel.attributedText = mat;

我应该为范围做些什么?

解决方法

对于您可能想要使用的范围:
NSMakeRange (0,mat.length);

喜欢这个:

NSMutableAttributedString *mat = [self.tableLabel.attributedText mutablecopy];
[mat addAttributes:@{NSUnderlinestyleAttributeName: @(NSUnderlinestyleSingle)} range:NSMakeRange (0,mat.length)];
self.tableLabel.attributedText = mat;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐