Próbuję przykleić przypisany ciąg do mojego NSTextView, ale po prostu pokazuje się jako zwykły tekst, bez atrybutów. Tworzę ciąg tak:NSTextView i 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];
i na NSTextView (wewnątrz widoku przewijania) Mam „Pozwala Rich Text” pole zaznaczone nadal, a pole edycji zaznaczone. Zasadniczo próbuję użyć tego jako okna wyjściowego konsoli.
Dziękujemy! To działało idealnie. – Gargoyle