8
属性付きの文字列をNSTextViewに貼り付けようとしていますが、単純なテキストとして表示されているだけで、属性はありません。私はボックスまだチェックし、「リッチテキストができます」と、編集可能なボックス未チェックを持っているNSTextViewとNSAttributedString
NSString *str = @"Parsing Directory Structure\n\n";
NSMutableAttributedString *attrstr = [[NSMutableAttributedString alloc] initWithString:str];
NSDictionary *attributes = @{
NSForegroundColorAttributeName : [NSColor blueColor],
NSFontAttributeName : [NSFont fontWithName:@"HelveticaNeue-Bold" size:20.f]
};
[attrstr setAttributes:attributes range:NSRangeFromString(str)];
[[self.textView textStorage] appendAttributedString:attrstr];
とNSTextView(スクロールビュー内)の:私はそうのように私の文字列を作成しました。私は基本的にこれをコンソール出力ウィンドウのように使用しようとしています。
ありがとうございました!それは完璧に働いた。 – Gargoyle