📜  按钮侦听器数组 swift 代码示例

📅  最后修改于: 2022-03-11 15:01:00.478000             🧑  作者: Mango

代码示例1
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)
            }
        }
    }
}