【发布时间】:2017-02-18 02:43:56
【问题描述】:
我有一个 CoreData 对象,它的关系是 NSSet。我正在尝试将其用作我的数据源,但得到以下内容
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = playerTableView.dequeueReusableCellWithIdentifier("Cell")! as UITableViewCell
cell.textLabel?.text = self.game.players[indexPath.row]
return cell
}
如何在 tableView 中使用我的 NSSet,我相信这将是无序的,因此每次都可能不同,那么我该如何订购这个集合?
【问题讨论】:
-
如果你想给一个集合带来秩序,那么你应该将元素加载到一个数组中。
-
@TimVermeulen 是的,我已经开始关注这个,它在我的列表中排名第二。我想我可以按名称将 CoreData 对象排序到一个数组中?
-
例如,是的。
标签: swift uitableview nsset