1 使用uiview显示hml
Demo+NSAttributedString-Additions-for-HTML.zip
Demo+NSAttributedString-Additions-for-HTML.zip
NSAttributedString-Additions-for-HTML-master.zip
2使用TTTAttributedLabel不支持对齐,显示hml
使用由 NSAttributedString-Additions-for-HTML的[NSAttributedStringalloc]initWithHTML
来生成TTTAttributedLabel所需要的NSAttributedStrings就可以用UIable显示html了
3使用OHAttributedLabel支持对齐 (推荐)
- //html内容
- NSString *name = [dataArray objectAtIndex:row];
- //必须设置
- cell.name.text = name;
- //居中显示
- cell.name.textAlignment = NSTextAlignmentCenter;
- //转换
- NSMutableAttributedString *string = [OHASBasicHTMLParser attributedStringByProcessingMarkupInAttributedString:cell.name.attributedText];
- //再设置
- cell.name.attributedText = string;