use*_*042 9 string objective-c ios
我试图在标签中强调一些文字.但是,我不知道如何获得标签中整个文本的范围.这是我到目前为止:
NSMutableAttributedString *mat = [self.tableLabel.attributedText mutableCopy];
[mat addAttributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)} range://??];
self.tableLabel.attributedText = mat;
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
Are*_*res 22
对于您可能想要使用的范围:
NSMakeRange (0, mat.length);
Run Code Online (Sandbox Code Playgroud)
像这样:
NSMutableAttributedString *mat = [self.tableLabel.attributedText mutableCopy];
[mat addAttributes:@{NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle)} range:NSMakeRange (0, mat.length)];
self.tableLabel.attributedText = mat;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10622 次 |
最近记录: |