【发布时间】:2016-09-30 06:39:37
【问题描述】:
我是我的应用程序中的 CORE DATA 的新手,我正在使用 coredata。 我只是将数据存储在我的核心数据中。我的实体名称是“FEED”,我有一个名称为“title”、“id”、“link”、“desc”的行,所以现在我想根据“id”删除特定的行。那么我该怎么做呢?
这是我的代码,
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
}
那我该怎么做呢?
【问题讨论】:
标签: ios swift sqlite uitableview core-data