1.加載HTML標(biāo)簽的产禾,純文字的浓体,加上這段代碼就可以搞定了挤悉。
cell.textLabel.numberOfLines= 0;
NSAttributedString*attrStr = [[NSAttributedStringalloc]initWithData:[htmlTxtStrdataUsingEncoding:NSUnicodeStringEncoding]options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType}documentAttributes:nilerror:nil];
cell.textLabel.attributedText= attrStr;
cell.textLabel.font= [UIFontsystemFontOfSize:15.0f];
2.加載html數(shù)據(jù)垦沉,圖文結(jié)合的那種煌抒。
我在demo里用text文本加載了html數(shù)據(jù)標(biāo)簽,但是圖片沒(méi)顯示出來(lái)厕倍,我自己的項(xiàng)目用數(shù)據(jù)源加載時(shí)沒(méi)問(wèn)題寡壮,如果你們用的話,可以用自己的數(shù)據(jù)源來(lái)試試看绑青。
github地址:https://github.com/shmily1119/WebviewAdaptionCell