Like I said, read my first post. I clearly state to add this code in the text field's delegate method. The name of the method is in my first post.
May I politely suggest reading the docs on UITextField and UITextFieldDelegate. That may help out some.
The basic idea is that this delegate method gets called on every button you tap on the keyboard, including the delete key. Just reject invalid values based on the needs of your text field.