Is there an iPhone equivalent to the NSTokenField

2019-01-07 13:44发布

In my app I want the user to type names into a UITextField (or equivalent) and then when they press return, it will put that word(s) in a blue bubble that's usually associated with tags. The cursor then moves to the end where they can add more "tags".

This can be seen when adding contacts in the To, CC & BCC fields in the Mail app, and also when selecting contacts in the Messages app.

How is this done? Is it something that's provided in the UIKit or available somewhere else?

Many thanks,

Michael

3条回答
狗以群分
2楼-- · 2019-01-07 13:46

I dont think you can do it with any built in functionality in the SDK, never seen such a feature. What you could do however is implement it yourself, have some custom blue button with some text over it, and when the user hits return you can have some code that takes the text and returns you the button that you need, shouldnt be too bad to implement

查看更多
神经病院院长
3楼-- · 2019-01-07 13:50

edited:

The equivalent control in desktop Cocoa is an NSTokenField, but there doesn't seem to be an equivalent for Cocoa Touch.

查看更多
萌系小妹纸
4楼-- · 2019-01-07 14:03

Venmo just open sourced their token field.

https://github.com/venmo/VENTokenField.git

查看更多
登录 后发表回答