2

I'm trying to think of the best approach to get an interface like this:

tokens with x button

They are similar to the Stack Overflow tokens that you enter when asking a question, except I don't need to be able to type the tokens in, just add/remove them programmatically.

enter image description here

As you can see, they are left aligned, variable width, and something can be triggered by the 'x' button.

UICollectionView seems overkill. UIStackView will only allow one row (?). UITextField / UITextView doesn't work well with images. What is the right approach to take?

cannyboy
  • 24,180
  • 40
  • 146
  • 252

3 Answers3

3

UICollectionView is what you're looking for, it doesn't seem overkill. Unless you want to implement a custom solution.

Sealos
  • 562
  • 3
  • 15
2

I need same functionality, I little investigate possible solutions, and this one look as good startpoint CloudTagView

Miro Durkovic
  • 79
  • 1
  • 5
2

This is perfect for you, written in Swift:

https://github.com/xhacker/TagListView

This can be also used, written in Objective-C:

https://github.com/ali312/TLTagsControl

In case you choose obj-c library, here is How to call Objective-C code from Swift

Community
  • 1
  • 1
pedrouan
  • 12,762
  • 3
  • 58
  • 74