Question

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?

Was it helpful?

Solution 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.

OTHER TIPS

Set the attributed string in the text storage.

[[myTV textStorage] setAttributedString:myTextStorage];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top