我是新来的核心数据在我的应用程序中我正在使用coredata。 我刚刚将数据存储在我的核心数据中。我的实体名称是“FEED”,并且我有一个名为“title”,“id”,“link”,“desc”的行,所以现在我想根据“id”删除特定的行。所以我怎么做到这一点?如何删除coredata(实体)行ios swift
这里是我的代码,
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell : MessageMusicCell = tableView.dequeueReusableCellWithIdentifier("MessageMusicCell") as! MessageMusicCell
cell.pinButton.tag = indexPath.row
cell.pinButton.addTarget(self, action: #selector(MessageViewController.buttonDeletePressed(_:)), forControlEvents: UIControlEvents.TouchUpInside)
cell.selectionStyle = .None
person = people[indexPath.row]
cell.lbl_title_msg_music.text = person!.valueForKey("title") as? String
cell.img_message_music.image = UIImage(named: "PlaceHolder")
cell.desc_msg_music.text = person!.valueForKey("desc") as? String
return cell
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
print(people.count)
return people.count
}
func buttonDeletePressed(sender:UIButton) {
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let cell : MessageMusicCell = tableView.dequeueReusableCellWithIdentifier("MessageMusicCell") as! MessageMusicCell
}
,所以我怎么能做到这一点?
其工作感谢 –
不客气。 –