如何在Swift中制作标签列表?

问题描述:

我想创建一个标签列表,该标签将从数组中获取,但是如何将其样式化为:

I want to create a list of tags, what I'll take from an array, but how can I stylize it as:

气泡内,如果行已满,则自动放置在下一行中.有提示或想法吗?

inside of bubbles and auto place in the next row if the line is full. Any tips or ideas?

请阅读此库链接,在其下方提供了很棒的自定义标签设计以及您设计所需的所有东西.

Please read this library link giving below it has awesome and custom tag design all the things you required for your design.

https://github.com/ElaWorkshop/TagListView

这里是使用方法.

  1. 添加其cocoapods [pod"TagListView"].
  2. 创建一个想要在其上显示所选标签并对其进行约束的视图.
  3. 将视图类名称更改为"TagListView".
  4. 在viewDidLoad()上设置委托.[yourView.delegate =自己]
  5. 现在使用它.例如.

yourView.addTag(标签上的名称")或yourView.addTags([[标记在第一个名称",标记在第二个名称",标记在第三个名称",.....依此类推])

yourView.addTag("Name on Tag") or yourView.addTags(["Name on Tag First","Name on Tag second","Name on tag third",.....and so on])