I have an RTF file in my project loading into a UILabel as attributed text (iOS 7). It displays as plain text with no formatting. I assume it's a font issue since the fonts I choose in Xcode aren't necessarily the fonts in iOS. The font I want is Helvetica Neue or Helvetica. But no font or styling I choose is ever recognized.
RTF:
iPad screen shot:
Code:
NSError *error = nil;
NSURL *resourceURL = [[NSBundle mainBundle] URLForResource:@"terms-english" withExtension:@"rtf"];
NSDictionary *docAttributes = nil;
[self.termsLabel setAttributedText:
[[NSAttributedString alloc] initWithFileURL:resourceURL
options:nil
documentAttributes:&docAttributes
error:&error]];
error is nil and the docAttributes coming back look correct:
{
BottomMargin = 72;
CocoaRTFVersion = "1265.21";
DefaultTabInterval = 36;
DocumentType = NSRTF;
HyphenationFactor = 0;
LeftMargin = 72;
PaperMargin = "UIEdgeInsets: {72, 72, 72, 72}";
PaperSize = "NSSize: {612, 792}";
RightMargin = 72;
TopMargin = 72;
UTI = "public.rtf";
ViewSize = "NSSize: {450, 420}";
}