0
當我重新使用UISearchController
時,出現致命錯誤:數組索引超出範圍。我閱讀了一些材料,但沒有找到答案。請幫幫我。當重用UISearchController時,我得到致命錯誤:數組索引超出範圍
我的代碼如下
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1 ?? 0 // 1 ?? 0
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
var query: PFQuery = PFQuery(className: "NewsNow")
if self.dataSearchResults == nil {
return self.objects?.count ?? 0
} else {
return self.dataSearchResults?.count ?? 0
}
}