например,
Когда я выполняю кнопку, я бы хотел, чтобы alertActions не включались (alertActions находятся на UIAlertController, и я снова выполняю кнопку, я бы хотел, чтобы alertActions были Я попробовал приведенный ниже код, но, похоже, они не меняются в режиме реального времени при каждом нажатии кнопки.
var testButtonForClick: UIButton!
var flagForClickChecking:Bool = false
func button(){
testButtonForClick = UIButton(frame: CGRect(x: 15, y: 190, width: 70, height: 70))
testButtonForClick.setTitle("Tap here", for: .normal)
testButtonForClick.titleLabel?.font = UIFont.preferredFont(forTextStyle: .title1)
testButtonForClick.setTitleColor(UIColor.blue, for: .normal)
testButtonForClick.addTarget(self, action: #selector(itsIng), for: .touchUpInside)
ThisCustomView.addSubview(testButtonForClick)
}
@objc func itsIng() {
flagForClickChecking = true
}
if self.check == true {
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {(alert: UIAlertAction!) in print("cancel")})
alertControllers.addAction(cancelAction)
alertControllers.addAction(add)
if flagForClickChecking == true {
add.isEnabled = false
cancelAction.isEnabled = false
}
}