Answers for "how to add elements in swift with a button"

0

array of button listeners swift

class ViewController: UIViewController {
    @IBOutlet weak var verticalStackView: UIStackView!

    var allButtons = [UIButton]()

    override func viewDidLoad() {
        super.viewDidLoad()

        for case let horizontalStackView as UIStackView in verticalStackView.arrangedSubviews {
            for case let button as UIButton in horizontalStackView.arrangedSubviews {
                allButtons.append(button)
            }
        }
    }
}
Posted by: Guest on June-15-2020

Code answers related to "how to add elements in swift with a button"

Code answers related to "Swift"

Browse Popular Code Answers by Language