![](/img/trans.png)
[英]TableView in a TableViewController, reload data, and indexPathForSelectedRow don't work
[英]reload data fail within tableviewController
class SelectionBoxViewController: UITableViewController,UISearchBarDelegate {
var searchbar = UISearchBar()
override func viewDidLoad() {
super.viewDidLoad()
searchbar.delegate = self
}
func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
tableView.reloadData()
}
}
它使用EXC_BAD_ACCESS
在tableView.reloadData()
EXC_BAD_ACCESS
。
可能是兩件事(包括):
嘗試將此函數添加到您的類中:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 0
}
還有這個:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return UITableViewCell()
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.