Hey guys, I basically have a working hours calculator in the works and I was wondering how I can disable certain numbers from being put into a field. For example, for the minutes field, I would like to prevent 61-99 being inputted. What sort of code would I need to make that work?
A:
You need to look up NSFormatter
, specifically NSDateFormatter
or NSNumberFormatter
. A formatter can be added directly to a text field in InterfaceBuilder; you simply drag it from the palette onto the text field. You could also use a datepicker (NSDatePicker
). You will find all of these in the various palettes in IB.
Williham Totland
2010-02-22 14:16:43