jeudi 8 décembre 2016

dynamic create checkbox as array size in swift

I Want to create a view with dynamic create checkbox i know how to create c checkbox dynamic but how to manage size of view?

Here is my Code:

var spacer: CGFloat = 23

    for comments in fixer as NSArray {
        var counter = ""
        print(comments)
        counter = comments as! String

        let button = UIButton(frame:CGRect(x: 8, y: 0+spacer , width: 20, height: 20))
        button.setTitle("hi", for: .normal)
        self.assignfixerView.addSubview(button)

        let label = UILabel(frame:CGRect(x: 40, y: 0+spacer , width: 80, height: 22))
        label.text = counter
        self.assignfixerView.addSubview(label)
        spacer = spacer + 23
    }

Here is my view :

enter image description here

in this user are not fix and i want status(label) and textfield position change and if i create this button than how's the selection process?

Please give me better /suggestion if any better controller than it will be ok

OR any dropdown with multiple selection and after selection all will be display in textfield

Thank You in Advanced!

Aucun commentaire:

Enregistrer un commentaire