views:

322

answers:

3

On the iPhone's mail app, you can type in multiple mail addresses...and then to delete one you just tap it, and click Del. How can I implement something similar in my app? I tried to handle the tap on a UITextView, but it looks like the touchesBegan and related delegate methods are not fired for this class and its subclasses :(

Any idea?

+2  A: 

I have implemented a view that is identical to what is found in the mail.app. I used a composite view comprised of a custom UIView which houses a couple of other types of views. I used a UITextField for the text entry. As the user completes an address I take the text and place it in a button with a custom background image (to get the bubble around the text look) and move the UITextField to the right (or to the next line as the case may be). When the user taps one of the address "bubbles" it is selected. If they hit the delete key I remove that bubble from the view and re-layout everything. This is a non-trivial view to build with lots of fun edge cases.

m4rkk
A: 

That sound interesting. Would you please share part of your code for it?

devguy
A: 

Check out Joe Hewitt three20 project, it includes "Better text fields" which can do such thing.

catlan