0

iOS 7.1 でプロジェクトをビルドするまでは問題なく動作するコードがあります。以前は、テキストが PDF ページに正しく表示されていました。

[strSomeText drawInRect:rectForText withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, mutParagraphStyle, NSParagraphStyleAttributeName, colorRed, NSForegroundColorAttributeName, nil]];

しかし今、整形辞書のすべてが無視されています。PDF ドキュメントには、デフォルトのフォントとサイズの黒いテキストが表示されます。

回答ありがとうございます。

4

2 に答える 2

0

を使用してみて、NSAttributedStringこれが機能するかどうかを確認します。あなたのコードが機能しなくなった理由について、私には正当な理由はありませんが、これを試してください:

//    obviously these variables are examples, keep whatever variables you are using
UIFont *font = [UIFont fontWithName:@"whatever_font" size:16.0f];
NSParagraphStyle *paragraphStyle = [NSParagraphStyle defaultParagraphStyle];

NSDictionary *attributes = @{NSFontAttributeName : font, NSParagraphStyleAttributeName : paragraphStyle, NSForegroundColorAttributeName : [UIColor redColor]};

NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:exampleString attributes:attributes];

[attributedString drawInRect];
于 2014-04-06T12:27:23.527 に答える