HTML String Content for UILabel and TextView
I have an object with the contents of the html markup in it, for example:
string = @"<p>This is wonderful</p> <p>Also some ‘ entidies ’ <p>"; so I want to convert this function to my shortcut text first.
the second step is to convert my p-tags to line breaks.
The third step is to convert my img tags to uiimageviews and some simple formatting for the text b, strong, etc.
Do you have any ideas how to solve my problem?
You should take a look at the Three20 project, which includes the TTStyledTextLabel class, which allows you to display HTML code and even activate links.
TTStyledTextLabel *htmlLabel = [[[TTStyledTextLabel alloc] initWithFrame:self.contentView.bounds] autorelease]; htmlLabel.userInteractionEnabled = YES; [aView addSubview:htmlLabel]; htmlLabel.text = [TTStyledText textFromXHTML:htmlText];