在编辑模式下的UITableView – 删除滚动上的buttonDissapears

我有一个TableView拉入自定义GroupTableView的自定义单元格。 在不处于编辑模式时,我可以滚动浏览而不会出现任何问题(所有的数据都保留在正确的单元格中)。 但是,当我进入编辑模式时,在滚动表格时,删除button消失。

这是我的tableview的代码:

func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int { return groups.count } func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { var cell: GroupTableView = tableView.dequeueReusableCellWithIdentifier(groupCellID) as GroupTableView if (cell == nil) { cell = GroupTableView(style: UITableViewCellStyle.Default, reuseIdentifier: groupCellID) } cell.groupName.text = groups[indexPath.row].groupName cell.groupOwner.text = "OwnerID: \(groups[indexPath.row].ownerID)" cell.numPosts.text = groups[indexPath.row].numPosts return cell; } func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) { if (groupTableView.editing == true) { self.performSegueWithIdentifier("segueToGroupDetail",sender:self) } else { self.performSegueWithIdentifier("segueToLinkView",sender:self) } } 

这是我的代码来启用编辑模式:

  override func viewDidLoad() { super.viewDidLoad() self.navigationItem.leftBarButtonItem = self.editButtonItem() } override func setEditing(editing: Bool, animated: Bool) { super.setEditing(editing,animated:animated) groupTableView.setEditing(editing,animated:animated) } 

这是写得很快,但希望在概念上类似于如何在目标c中完成。