func updateSearchResultsForSearchController(searchController: UISearchController) {
self.filteredfarger.removeAll(keepCapacity: false)
我收到错误
“类型'[(String)]'的不可变值仅具有命名的变异成员 '的removeAll'“
let searchPredicate = NSPredicate(format: "SELF CONTAINS[c] %@", searchController.searchBar.text!)
let array = (self.TitleList as NSArray).filteredArrayUsingPredicate(searchPredicate)
self.filteredfarger = array as! [String]
我收到错误:
“无法在'self'中指定'filteredfarger'
self.tableView.reloadData()
}
非常感谢你的帮助
答案 0 :(得分:0)
似乎filteredfarger是不可变的。您是否使用' let'来定义它?或者' var' ?
可以在此处找到searchBar的优秀教程: http://www.ioscreator.com/tutorials/add-search-table-view-tutorial-ios8-swift