ElaWorkshop / TagListView

Simple and highly customizable iOS tag list view, in Swift.
MIT License
2.64k stars 492 forks source link

How can i set only single tag selection at a time? #205

Closed hardikamal closed 5 years ago

hardikamal commented 6 years ago

Hi,

Is it possible to set only one tag selected at a time? ie I want the tags to act like radiobutton.

defyreborn commented 6 years ago

You can select a single tag with long press.

poojakaluskar commented 5 years ago

@hardikamal I don't think it's possible at the moment with the library. I had similar requirements in my code and I ended up deselecting other tags when one tag is being selected.

mytag.onTap = {tapView in // unselect other tags }

NirajCapermint commented 5 years ago

@hardikamal user this

func tagPressed(_ title: String, tagView: TagView, sender: TagListView) { print("Tag pressed: \(title), \(sender)") for ta in sender.tagViews { if ta.titleLabel?.text == title { ta.isSelected = !ta.isSelected }else{ ta.isSelected = false } } }