Reloading searchResultsTableView

老子叫甜甜 提交于 2019-12-08 14:29:32

If I understood you right, then you can have a workaround but searching again with the same search string:

if (self.searchDisplayController.active) {
    self.searchDisplayController.searchBar.text = self.searchDisplayController.searchBar.text;
}

put it in viewWillAppear: or viewDidAppear: which will be called each time the view is shown up (eg. you go back from the detail view to your search view). And reloading the data in this place would be nice too, to get the right data (for example if you marked the cell as read like in your sample code)

Just [self.tableView reloadData]; and not the searchResultsTableView (it will be automatically use the updated data after the new search)

It sounds as if perhaps your cells are being recycled and not reset properly. UITableView uses view recycling, so it's important that if you do something such as set an image you make sure it is explicitly set even when their isn't an image to display.

If you share your cellsForRowAtIndexPath code you might be able to get some more help.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!