Jakub Kontra Jakub Kontra - 4 months ago 40x
Swift Question

Swift iOS - Tag collection view

I'm writting my first iOS app and I wanna just answer what is the best known solution to make this? It's simple tag collection. Or if someone already use that plugin.

I have already looked over the Internet but I have found nothing.

** My Solution: **
I think the best way can be make my own structure of buttons maybe?
Thanks for your answers, I hope, more heads = more clever.

Swift Tag collection view


I resolve this problem, using collection view.

class FilterController: UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {

    @IBOutlet var collectionView: UICollectionView?

    override func viewDidLoad() {

    // Do any additional setup after loading the view, typically from a nib.
    let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
    layout.sectionInset = UIEdgeInsets(top: 150, left: 10, bottom: 150, right: 10)
    // layout.itemSize = CGSize(width: 90, height: 45)
    layout.itemSize = CGSizeFromString("Aloha")

    collectionView = UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
    collectionView!.dataSource = self
    collectionView!.delegate = self
    collectionView!.registerClass(TagCell.self, forCellWithReuseIdentifier: "TagCell")
    collectionView!.backgroundColor = UIColor.whiteColor()