I am trying to set up a custom formatter (named TextFieldFormatter) for my text fields, limiting them to 3 characters maximum and only allowing decimal values. TextFieldFormatter is a subclass of NSFormatter and my textfields are NSTextFields. I’m using the method isPartialStringValid:newEditingString:errorDescription: to do my formatting.
The problem that I am having right now, is that I do not know how to link TextFieldFormatter to the text fields.
So, how can I do this?
You can set the
formatterproperty programmatically, or you can create anNSObjectin IB, set its class toTextFieldFormatter, and then tie theformatterproperty to it in IB.