首页 > 解决方案 > 我的应用程序没有执行我编写的 Swift 代码

问题描述

我试图理解为什么我的代码没有完全被我的应用程序播放?

实际上我在viewController上有一个按钮,当用户按下按钮时,两个文本字段是正常的变成交互的并且背景会改变以显示交互的可能性。当我完成代码并进行第一次测试时,它就可以工作了!它也可以在其他视图中使用,但经过一些测试后,按钮只是更改了他的隐藏属性,但什么也不做。参考代码:

 @IBAction func modifyBtnWasPressed(_ sender: UIButton) {

    //We change the button by the save button

    modifyBtn.isHidden = true
    saveBtn.isHidden = false

    //We enable 2 tf and we show to the user the 2 TF which will be enable

    acftRegistrationTxt.isUserInteractionEnabled = true
    acftModelTxt.isUserInteractionEnabled = true

    acftRegistrationTxt.backgroundColor = UIColor(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0);
    acftModelTxt.backgroundColor = UIColor(red: 0.9, green: 0.9, blue: 0.9, alpha: 1.0);


}

现在在这种情况下,只有 isHidden 属性起作用,接下来的 4 行不适用于应用程序。

标签: iosswiftuitextfield

解决方案


推荐阅读