I have a NSTextView
and i have a custom NSFormatter
that limits the string length. But how do i "[_textView setFormatter:customFormatter]
" on a NSTextView
? I can't find how to do that.
Example code would be appreciated!
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- Visual Studio Code, MAC OS X, OmniSharp server is
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- IntelliJ IDEA can't open projects or add SDK o
- Automator: How do I use the Choose from List actio
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
It's not possible to use a custom NSFormatter with a NSTextView. (That appears to be the province of NSControl, of which NSTextField is a subclass.)
However, it is possible to set up a delegate for your text view's text storage (
NSTextStorage
), and implement-textStorageWillProcessEditing:
(a method ofNSTextStorageDelegate
) ; this is where you could constrain your user's input. Your existing code for your custom NSFormatter might be adapted for use there.