On 28/09/2011, at 11:41 AM, William Squires wrote:
Is there a general way of validating the contents of a field before it
resigns first responder status?
The preferred, supported way is to use a NSFormatter attached to the field.
This has the ability to fully constrain and convert values
On Sep 27, 2011, at 6:41 PM, William Squires wrote:
Hi,
I have a need for a complex data-entry form (window). Some fields are
supposed to only accept alpha characters (upper or lower), some are supposed
to only take integers, others to only take floats (but no negative values
allowed).
You can use formatters for this too. Here's the code I'm using (modify
the characters you need to allow in addCharactersInString:).
// allow only digits and +-*/.
- (BOOL)isPartialStringValid:(NSString **)partialStringPtr
proposedSelectedRange:(NSRangePointer)proposedSelRangePtr
It's in NSFormatter. You just override it in your subclass.
Cheers,
Andre Masse
William Squires mailto:wsqui...@satx.rr.com
September 28, 2011 20:48
Okay, but where does the code go? Is this a delegate method
Hi,
I have a need for a complex data-entry form (window). Some fields are
supposed to only accept alpha characters (upper or lower), some are supposed to
only take integers, others to only take floats (but no negative values
allowed). Is there a general way of validating the contents of a