/
NSMutableAttributedString
NSMutableAttributedString
NSString *text = self.model.text; if (self.model.searchTemplate != nil) { if ([self.label respondsToSelector:@selector(setAttributedText:)]) { self.label.text = nil; NSDictionary *attribs = @{ NSForegroundColorAttributeName: self.label.textColor, NSFontAttributeName: self.label.font }; NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:text attributes:attribs]; NSRange redTextRange = [[text lowercaseString] rangeOfString:[self.model.searchTemplate lowercaseString]]; [attributedText setAttributes:@{NSForegroundColorAttributeName:[UIColor blueColor]} range:redTextRange]; self.label.attributedText = attributedText; } else { self.label.text = text; } } else { self.label.text = text; }
, multiple selections available,
Related content
NSString+MD5
NSString+MD5
More like this
UIColor to UIImage
UIColor to UIImage
More like this
ios开发代码统计
ios开发代码统计
More like this
NSLayoutConstraint-代码实现自动布局的函数用法说明
NSLayoutConstraint-代码实现自动布局的函数用法说明
More like this
UIEdgeInsets
UIEdgeInsets
More like this
UIGetScreenImage
UIGetScreenImage
More like this