I am making some text viewer app. Currently I need very frequent and precise line handling ability, so I want to subclass NSTextStorage
class. But I couldn't find any method to set a new text storage to NSTextView
. The only method I could find was
-[NSLayoutManager replaceTextStorage:]
method. But it's confusing whether this is what I was looking for. Because it seems just replace text storage of linked NSLayoutManagers instead of NSTextView.
I also considered subclassing NSTextView and overriding -textStorage
method, but if the class is not designed for subclassing, it will make undefined result.
Anyone has tried to use custom NSTextStorage on NSTextView? How can I do this? Or is this prohibited by design?