0
私は解析してHTMLコンテンツを表示しているので、うまく動作します。しかし、斜体のタグは機能しません。私はカスタムフォントを使用しています。以下にサンプルコードを示します。iOSのUITextViewで解析されたHTMLコンテンツにカスタムフォントを追加するとイタリックフォントが機能しない
NSString *messages = @"<b>Bold</b><br><i>Italic</i><p> <del>Deleted</del><p>List<ul><li>Coffee</li><li type='square'>Tea</li></ul><br><a href='URL'>Link </a>";
NSString *stringWithFont = [NSString stringWithFormat:@"<span style=\"font-family: OpenSans; font-size: 14\">%@</span>", messages];
NSAttributedString *attributedString = [[NSAttributedString alloc]
initWithData: [stringWithFont dataUsingEncoding:NSUnicodeStringEncoding]
options: @{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType }
documentAttributes: nil
error: nil
];
_notificationTextView.attributedText = attributedString;
これは、イタリック体が機能しないように見えます。
UPDATE
現在、私のプロジェクトは、私は光のフォントや私のプロジェクトからの参照を削除した場合、それが思わので、すべてのOpensansフォントセットのように、定期的に、斜体、太字、semiboldなどが含まれます作業。普通のフォントと明るいフォントとの奇妙な対立のように見えます。誰にでもアイデアはありますか?
あなたのバンドルにはイタリック体が含まれていますか? –
はいバンドルに追加されました。これは私がhttp://www.mediafire.com/file/cpjerw9wwwwpmpm/OpenSansFont.zip – Gamerlegend
を使用しているフォントファイルで、plistにも追加されていますか? –