I can get the string size using This method
[myString sizeWithAttributes:@{NSFontAttributeName :myFont}
but, my string has HTML content , I tried to do it like this
[myString sizeWithAttributes:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,NSFontAttributeName :myFont}
but,I got a wrong value ?
also I tried to use NSAttributedString
like this
NSAttributedString * tabText = [[NSAttributedString alloc] initWithData:[myString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,myFont: NSFontAttributeName} documentAttributes:nil error:nil];
CGSize mySize=[tabText size];
And also I got a wrong value .
my string is very basic HTML content like "test & test
" it returns
the width of 15 chars not 11