此行导致编译器警告searchDisplayController弃用:从Xcode 6.3更新开始。
问题行 if tableView == self.searchDisplayController!.searchResultsTableView
在
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if tableView == self.searchDisplayController!.searchResultsTableView {return self.filteredPlayers.count}
else {return self.results.count;}
}
我在格式
的其他行中解决了这个警告func searchDisplayController(controller: UISearchDisplayController, shouldReloadTableForSearchScope searchOption: Int) -> Bool {
let scope = self.searchDisplayController?.searchBar.scopeButtonTitles as! [String]
self.filterContentForSearchText(self.searchDisplayController!.searchBar.text, scope: scope[searchOption])
return true
}
删除Display
并从searchDisplayController?
行删除let scope = self.searchDisplayController?.searchBar.scopeButtonTitles
,
func searchController(controller: UISearchController, shouldReloadTableForSearchScope searchOption: Int) -> Bool {
let scope = self.searchBar.scopeButtonTitles as! [String]
self.filterContentForSearchText(self.searchBar.text, scope: scope[searchOption])
return true
}
但我无法弄清楚上面的ISSUE LINE的正确编辑。
if tableView == self.searchController!.searchResultsTableView //could not find member 'searchResultsTableView'
和
if tableView == self.searchResultsTableView //ViewController does not have a member named 'searchRsultsTableView'