I'm building a productivity app and doing some light testing on the simulator and on my iPhone 5. The App has a number of text fields that are numeric and would never ask for a negative entry. So from the beginning I had set the keyboard for those fields to be "Numeric Decimal".
However, I noticed something bizarre while viewing some test data on an actual iPhone device. Somehow an entry was showing up in tableview and editview as a negative value. I'm not sure when it happened, but more importantly I'm not sure how it happened. No data is supplied on install or update. The problem object had to have been entered directly on the device, WITH THE NUMERIC DECIMAL KEYPAD that has no negative operator key.
So any ideas what could have happened so I can trap it later?
Probably a value copied and pasted from somewhere else.
To block pasting into the text field would be the easiest solution, but not the most user friendly.
Check out the documentation for UITextFieldDelegate here.
You could set a method like
textFieldDidEndEditing:
to check for values and treat them accordingly, for example.