我有包含多个部分的 Tablview。
第一部分 -它包含搜索文本框
第二部分 -它包含 UIView
其他部分 - 这部分我想在搜索时重新加载。
更新
我设置了 countdic 和 tableview,如下所示:-
1. 设置 countdic
self.countDic.updateValue(1, forKey: "0")// this is for First section
self.countDic.updateValue(0, forKey: "1")//this is for second section
for i in 0..<arra1.count {
self.countDic.updateValue(array.count, forKey: "\(i + 2)")//[index : arraylist.count]
}
Run Code Online (Sandbox Code Playgroud)
2.这是我的tableview设置
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return countDic["\(section)"]!
}
func numberOfSections(in tableView: UITableView) -> Int {
return countDic.count
}
Run Code Online (Sandbox Code Playgroud)
3. 我在这里重新加载 tableview
这是来自UITextfield的 shouldChangeCharactersIn
let …Run Code Online (Sandbox Code Playgroud)