I'm working in a iOS project and I've got this HTML text that i need to display in a UITextView:
<a href="http://google.com" target="_blank" rel="nofollow" title="Link: http://google.com">http://google.com/</a><br><span class="wysiwyg-color-d24b57 ">TEST<br><i><span class="wysiwyg-color-704938 ">TEST2<br></span></i></span><div class="wysiwyg-text-align-left "><span class="wysiwyg-color-d24b57 "><span class="wysiwyg-color-704938 "><u><span class="wysiwyg-color-3a529c ">Test3<br>TEST4<br><br></span></u><span class="wysiwyg-color-3a529c wysiwyg-font-size-x-large ">Test5</span><u><span class="wysiwyg-color-3a529c "><br><br><br></span></u></span></span></div>
So far, I've created the NSAttributedString and the UITextView:
NSAttributedString *attributedString = [[NSAttributedString alloc]
initWithData: [example.text dataUsingEncoding:NSUnicodeStringEncoding]
options: @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType }
documentAttributes: nil
error: nil
];
UITextView *textView = [[UITextView alloc] init];
textView.frame = [node labelFrame];
textView.attributedText = attributedString;
textView.editable = NO;
textView.selectable = YES;
textView.backgroundColor = [UIColor clearColor];
return textView;
Now I have to apply the wysiwyg CSS on it, as at the moment, color, font-size and alignment are not working.
Does anybody have any idea how to to do this?
Thanks in advance!