Я пытаюсь получить фрагмент текста, который отформатирован в html, чтобы хорошо отображаться на iPhone в UITableViewCell.
Пока у меня есть это:
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];
Этот вид работ. Я получаю текст, который имеет "Ницца" жирным шрифтом! Но... он также устанавливает шрифт Times Roman! Это не тот шрифт, который я хочу. Я думаю, мне нужно установить что-то в documentAttributes, но я не могу найти нигде примеров.