NSAttributedString only works with Helvetica Neue
I'm trying to load a UITextView with an NSAttributedString. I'm loading
the NSAttributedString from a Rich Text File ".rtf".
The Names of the files in my [NSBundle mainBundle] are My
Text-HelveticaNeue.rtf, My Text-TimesNewRomanPSMT.rtf, and My
Text-MarkerFelt-Thin.rtf These files each have the correct font set. They
also have some text Bold.
Here's my code:
NSString *resourseName = [NSString stringWithFormat:@"My Text-%@",
self.currentFontName];
NSURL *rtfUrl = [[NSBundle mainBundle] URLForResource:resourseName
withExtension:@".rtf"];
NSError *error;
NSAttributedString *myAttributedTextString = [[NSAttributedString alloc]
initWithFileURL:rtfUrl options:nil documentAttributes:nil error:&error];
myTextView.attributedText = myAttributedTextString;
NSLog(@"%@", myAttributedTextString);
The Helvetica Neue file retains all formatting, including the text that is
bold. But the other files only retain their font; they do not retain what
text was bold. What could I be doing wrong?
No comments:
Post a Comment