Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

abcdefg12345

macrumors 6502
Original poster
Jul 10, 2013
281
86
I'm trying to limit character length in an app but i have no idea what I'm doing so i made a sample calculator app if anyone can add a code to it that limit how many characters u can inter in the field.
 

Attachments

  • Calculator.zip
    80.2 KB · Views: 106
I'm trying to limit character length in an app but i have no idea what I'm doing so i made a sample calculator app if anyone can add a code to it that limit how many characters u can inter in the field.

You can create a delegate referring to the specific NSTextField and overwrite the method
Code:
textShouldBeginEditing:
. It returns a bool, so you can either allow or disallow entering letters depending on how many characters have already been entered.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.