实现 带颜色的字符串你好 哇哈哈 来到了 店里


    NSString *str = @"你好 <span style='color: red'>哇哈哈</span> 来到了 <span style='color: green'>店里</span>";

        NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[str dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];

        

        cell.messageLabel.attributedText=attrStr;

 

essageLabel 是个lbl


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM