2
NSTextView에 특정 글꼴 및 색상의 텍스트를 넣으려고합니다. 나는 잘 텍스트를 넣을 수 있습니다,하지만 내 속성 잃는 : 나는 모든 관련 클래스 참조 (를 NSTextView, NSTextStorage, NSAttributedString은, 등 ...) 읽은왜 [NSTextStorage appendAttributedString :]은 NSAttributedString의 속성을 허용하지 않습니까?
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont fontWithName:@"Monaco" size:10], @"NSFontAttributeName",
[NSColor blueColor], @"NSForegroundColorAttributeName",
nil];
NSAttributedString *string = [[NSAttributedString alloc] initWithString:someNSString
attributes: dict];
[someNSTextStorage appendAttributedString:string];
을하고 난 아직도하지 않습니다 그것이 내가 예상했던대로 작동하지 않는 이유를 알아라.
내가 잘못했거나 누락 되었습니까?
여전히 어디에 문제가 있는지 잘 모르겠지만'[storage setForegroundColor : [NSColor blueColor]];와'[storage setFont : [NSFont fontWithName : @ "Monaco"size : 10]]; after appendAttributedString : – user992364