On desktop Cocoa I can put in a custom formatter on a textfield and get what I'm looking for. On iPhone, I can say I'm a bit confused as to the best way to handle this.

Given a UITextField and my desire to have the user type in an IP address, it sounds like it could be simple, but I can't figure it out.

Using

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString: (NSString *)string

works fine if I'm assuming the user is simply typing in the text going forward. The problem is if a user edits the text field then they lose their place as I set the text.

So my guess to this is that no I cannot do this (though I'm sure I've seen it on the iPhone), but would there be a good way to handle this properly?

"There will always be death and taxes; however, death doesn't get worse every year."
-- Anonymous




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to