Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 773 Bytes

README.markdown

File metadata and controls

18 lines (12 loc) · 773 Bytes

Why?

Although one may use NSNumberFormatter to achieve a similar result - what I don’t like about about that solution is this:

If a user types non-numeric characters into the NSTextField and attempts to tab away from the field, they get the default error sound and their tab attempt is denied.

To me this isn’t user friendly.

I figured I’d take a Javascript-esque approach to the problem: when the user has finished interacting with the text field, reset it's content to the value returned by [input intValue].

Usage

More to come - for now see this blog post: Subclassing NSTextField to Allow Only Numbers.

Todo

  • add an extended example limiting range