如何在 Swift 中制作标签列表? [英] How can I make tag list in Swift?

查看:26
本文介绍了如何在 Swift 中制作标签列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个标签列表,我将从一个数组中获取什么,但我怎样才能将其风格化为:

在气泡内,如果行已满,则自动放置在下一行.有什么建议或想法吗?

解决方案

请阅读这个库链接,它在下面给出了很棒的自定义标签设计,你需要为你的设计提供所有的东西.

<块引用>

https://github.com/ElaWorkshop/TagListView

这里是如何使用它.

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

<块引用>

yourView.addTag("标签上的名称")或 yourView.addTags(["Name on Tag First","Name on Tag second","Name on tag third",.....等等])

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

Here is how to use it.

  1. add its cocoapods [pod "TagListView"].
  2. Create a view on which you wanna to show your selected tags and constraint it.
  3. change your view class name to "TagListView".
  4. set delegate on viewDidLoad(). [yourView.delegate = self]
  5. now you use it. eg.

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

这篇关于如何在 Swift 中制作标签列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆