문제

Is there a way set an NSTextView's textStorage property to my own NSTextStorage? You can customize the NSTextContainer, so is there a way to do something like this:

NSTextView *myTV = [[NSTextView alloc] initWithFrame:CGFrameMake(0,0,100,100) 
                                    withTextStorage:myTextStorage];

If not, is there a way to swap out the default text storage after the text view is instantiated? Does this need to be done by subclassing NSTextView?

도움이 되었습니까?

해결책 2

Other than simply replacing the string in the storage, it doesn't seem like there's a way to replace the NSTextStorage object itself.

다른 팁

Set the attributed string in the text storage.

[[myTV textStorage] setAttributedString:myTextStorage];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top