所以我有一个按钮,看起来像在收集观察室厦门国际银行铅笔。集合视图单元格按钮不触发动作
然后,我有这样的代码。
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "groupsCollectionViewCellIdentifier", for: indexPath) as! GroupCollectionViewCell
//add action to the edit button
cell.editButton.tag = indexPath.row
cell.editButton.addTarget(self, action: #selector(GroupsCollectionViewController.editGroupAction), for: .touchUpInside)
return cell
}
//segue to edit group
func editGroupAction() {
performSegue(withIdentifier: "editGroupSegue", sender: self)
}
但每当我点击编辑按钮。什么都没有发生。我不知道缺少什么。
我已经分配给小区课堂上,Segue公司也有一个标识符。 –
你是否尝试断点,然后检查func是否被调用 –
所以在断点中它甚至没有调用函数。点击按钮什么也不做。 –