快速重新加载TableView后如何还原文本字段的第一响应者属性

问题描述

在我的表格视图单元格中,有两个文本字段。我有很多牢房。通过单击每个文本字段,将显示一个下拉菜单,其余的下拉菜单将被隐藏。选定的文本字段将是第一响应者。

但是要隐藏或显示不同字段的下拉菜单,每次单击文本字段时,我都会重新加载tableview。在重新加载表时,文本字段将退出第一响应者。该文本字段具有搜索功能,并且会辞退第一响应者。我无法搜寻。因此,任何人都可以帮助我恢复特定文本字段的第一个响应者属性

我的代码

func textFieldDidBeginEditing(_ textField: UITextField) {
    if textField == lCodeTextField{
        isdropDownSelected2 = false
        if isdropDownSelected1 {
            isdropDownSelected1 = false
            lcodeIndexpath = nil
            
        } else {
            isdropDownSelected1 = true
            lcodeIndexpath = IndexPath.init(row: myIndexPath!.row,section: myIndexPath!.section)
            qtyIndexPath = nil
 
        }
    } else {
        isdropDownSelected1 = false
        if isdropDownSelected2 {
            isdropDownSelected2 = false
            qtyIndexPath = nil
            
        } else {
            isdropDownSelected2 = true
            qtyIndexPath = IndexPath.init(row: myIndexPath!.row,section: myIndexPath!.section)
            lcodeIndexpath = nil
        }
    } 
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)