RE: Bindings making NSNumberFormatter strange
RE: Bindings making NSNumberFormatter strange
- Subject: RE: Bindings making NSNumberFormatter strange
- From: Ulai Beekam <email@hidden>
- Date: Thu, 23 Apr 2009 23:58:43 +0000
- Importance: Normal
> Using control:didFailToFormatString:errorDescription: and always
> returning YES will stop the "Formatting Error" sheet.
Is this the only way to stop that "formatting error" sheet? I tried it and it sure works. A major drawback, however, is that editing ends even if it was invalid.
And that means I have to implement the control:textShouldEndEditing: method and return NO from there if the state is invalid and YES otherwise. If I combine this with the previous method (control:didFailToFormatString:errorDescription:) returning YES, it seems to be working.
But even if it works, it is giving me some headaches because it seems like such a weird solution to get rid of a simple sheet. Why do I think it's weird? Because in the second method (control:didFailToFormatString:errorDescription:) I'm effectively doing all those validation checks all over again. Seems like a strange hack to me.
> A custom NSNumberFormatter subclass can be used to block characters
> that are not in decimalDigitCharacterSet and sound a beep. Read the
> last paragraph of:
Thanks for suggesting this. It seems to be working beautifully.
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/products/photos.aspx_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden