小编jok*_*449的帖子

How to enable UITableView when there is text in a textfield

I have two textFields and a TableView. The Tableview should initially be disabled (meaning the labels greyed out and the cells are not clickable). When both textFields have values, I want the TableView and the tableViewCells to be clickable and not greyed out. So far, I've added targets to both of the textfields to track when the user is editing:

var isUserEditing: Bool = false

func setup() {
        mealItemTextField.addTarget(self, action: #selector(userIsEditing), for: UIControl.Event.editingChanged)
        priceTextField.addTarget(self, action: #selector(userIsEditing), for: UIControl.Event.editingChanged)
    } …
Run Code Online (Sandbox Code Playgroud)

text uitableview uitextfield ios swift

1
推荐指数
1
解决办法
84
查看次数

标签 统计

ios ×1

swift ×1

text ×1

uitableview ×1

uitextfield ×1