My data is coming From Server with Html Tags.
I want to display it on my Text View as it's format (Bold, Font, etc). How can i display it?
Thanks in Advance
My data is coming From Server with Html Tags.
I want to display it on my Text View as it's format (Bold, Font, etc). How can i display it?
Thanks in Advance
NSString *infoString =@"I am iOS developer.";
NSMutableAttributedString *attString=[[NSMutableAttributedString alloc] initWithString:infoString];
UIFont *font_regular=[UIFont fontWithName:@"Helvetica" size:20.0f];
UIFont *font_bold=[UIFont fontWithName:@"Helvetica-Bold" size:20.0f];
[attString addAttribute:NSFontAttributeName value:font_regular range:NSMakeRange(0, 4)];
[attString addAttribute:NSFontAttributeName value:font_bold range:NSMakeRange(5, 18)];
[self.txtView setAttributedText:attString];
I use Web View For this. Create one object and load that string to web view. [_webView loadHTMLString:[strDescription description] baseURL:nil]; // set string to web view
For increase Dynamic Height of Web View:
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
CGRect frame = _webView.frame;
frame.size.height = 1;
_webView.frame = frame;
CGSize fittingSize = [_webView sizeThatFits:CGSizeZero];
frame.size = fittingSize;
_webView.frame = frame;
[self.view layoutIfNeeded];
NSLog(@"size: %f, %f", fittingSize.width, fittingSize.height);
_bgScrollView.contentSize = CGSizeMake(320, fittingSize.height+370);
}