UITableViewCellのiPhoneでうまく表示するために、htmlでフォーマットされたテキストのスニペットを取得しようとしています。
これまでのところ、私はこれを持っています:
NSError* error;
NSString* source = @"<strong>Nice</strong> try, Phil";
NSMutableAttributedString* str = [[NSMutableAttributedString alloc] initWithData:[source dataUsingEncoding:NSUTF8StringEncoding]
options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: [NSNumber numberWithInt:NSUTF8StringEncoding]}
documentAttributes:nil error:&error];
この種の作品。'Nice' が太字になっているテキストが表示されます。しかし... フォントも Times Roman に設定されます。これは私が望むフォントフェイスではありません。documentAttributes に何かを設定する必要があると考えていますが、どこにも例が見つかりません。