ios - 我的应用程序没有执行我编写的 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 行不适用于应用程序。
解决方案
推荐阅读
- java - 发生配置更改时如何不重置我的片段?
- python - 非分类项目的 Python/Beautiful Soap 数据提取问题
- android - 如何将 Firestore 与分页 3 和 RxPagingSource 一起使用
- google-chrome - 通过运行 chrome 控制台更改网页中所有元素的不透明度
- elasticsearch - 从 elasticSearch 归档日志文件并将它们带回以最大限度地降低存储成本
- android-jetpack-compose - 对话框中的 Jetpack 撰写布局更改不会更新大小
- android - 无法进行新构建:“admob.plus.core.Ad$1 已定义多次”
- python - 标签位置和大小
- mysql - 如何更新一个或多个字段而忽略 NODE MySQL 中的空字段
- generator - Rails 2.2.2 - 如何添加一个新的生成器来做与脚本/生成迁移相同的事情,但在不同的文件夹中?