• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UITextField formatting for IP Address
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UITextField formatting for IP Address


  • Subject: UITextField formatting for IP Address
  • From: Alex Kac <email@hidden>
  • Date: Fri, 16 Oct 2009 19:26:31 -0500

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 (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


  • Follow-Ups:
    • Re: UITextField formatting for IP Address
      • From: Alex Kac <email@hidden>
  • Prev by Date: Re: Extract plain text content from a Text View
  • Next by Date: Re: UITextField formatting for IP Address
  • Previous by thread: Re: Strange Core Data save behaviour ("required relationship nil"... when it is set the line before saving)
  • Next by thread: Re: UITextField formatting for IP Address
  • Index(es):
    • Date
    • Thread