Hi I am new to objective C. I am converting htmlString into NSMutableAttributedString. but when i changed font size of NSMutableAttributedString it removes bold font from my text, kindly give any solution.
My code:
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil ];
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
{
// overView.font = [UIFont systemFontOfSize:16];
[attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(0, attributedString.length)];
}
else{
// overView.font = [UIFont systemFontOfSize:12];
[attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:NSMakeRange(0, attributedString.length)];
}
overView.attributedText = (NSAttributedString *)attributedString;
Any help would be appreciated thanks.