【发布时间】:2015-07-10 00:19:31
【问题描述】:
我的viewDidLoad()中有以下代码
fetchedResultsController = NSFetchedResultsController(fetchRequest: FetchRequest("Teams", key: "team_name"), managedObjectContext: managedObjectContext!, sectionNameKeyPath: nil, cacheName: nil)
fetchedResultsController?.delegate = self
fetchedResultsController?.performFetch(nil)
我的 TableView cellForRowAtIndex 中的这段代码:
var cell = teamView.dequeueReusableCellWithIdentifier("team_cell", forIndexPath: indexPath) as! TeamCellSettings
if let cellContact = fetchedResultsController?.objectAtIndexPath(indexPath) as? Team {
//create cell here
}
return cell
我已在线阅读有关如何使用 NSPredicate 的信息,但我似乎无法让它发挥作用。我的目标是使用分段控件根据行属性的内容在 UITableView 中显示的结果之间进行切换。因此,如果我的实体 X 有一个名为 A 的属性,A 将存储 1 或 0,所以基本上我需要分段控件在 all 包含 1 的结果之间切换在A 属性中或A 属性中为0
我的创意写作技巧不是最好的。希望你能理解我的目标。谢谢。
【问题讨论】:
标签: ios uitableview core-data nspredicate