2

HTML string may be represented in a UITextView using NSAttributedString, like so,

NSAttributedString(data: html.dataUsingEncoding(NSUTF8StringEncoding)!, options: [NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: NSUTF8StringEncoding], documentAttributes: nil, error: nil)!

I also tried an alternate way to go about this.

func convertHTMLstring(text: UITextView, HTMLString: NSString)
{
    text.setValue(HTMLString, forKey: "contentToHTMLString")
}

The question is in two parts; is there a possibility of the app getting rejected for AppStore if I use the alternate way to display HTML string in UITextView? Also, when the cleaned, readable text is displayed on the UITextView, the font size gets overridden. In my case, it becomes smaller than specified. Is there a way to resolve this?

1 Answer 1

0

Part 1 - App Store rejection will only be because of one of the reasons in the App Review Guidelines. There's plenty to worry about there without considering how you format some text. But I doubt your text formatting alone would get you rejected.

Check this and read it carefully: https://developer.apple.com/app-store/review/guidelines/

Part 2 - Is it a UITextField or a UITextView. If your text is getting smaller than you've set in a UITextField it's probably because you have adjustsFontSizeToFitWidth set to YES and the text is wider than the text field. Fixing that would require us to see more of you code and maybe a screenshot.

If it's a UITextView check this answer: How to change the uitextview font size. See if you have it set to "Selectable" in the storyboard.

But you might want to make it just a label.

2
  • Also check this answer: stackoverflow.com/questions/6517135/…
    – badweasel
    Jan 2, 2015 at 11:14
  • 1
    I checked the answer and it resolved the font size issue on UITextView. I just had to explicitly specify the font size in my code. textView.font = UIFont.systemFontOfSize(15)
    – Lester
    Jan 2, 2015 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.