コレクションビューのセルxibの鉛筆のようなボタンがあります。コレクションセルのボタンがトリガされないアクション
その後、私はこのコードを持っています。
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)
}
いつでも編集ボタンをクリックします。何も起こっていない。私は何が欠けているのだろうか。
を働いているのiOS 10.Followingを使用している場合は、セグエはまた、識別子を持っています。 –
ブレークポイントを試して、funcが呼び出されたかどうかを確認していますか? –
ブレークポイントでは、関数を呼び出すことさえできませんでした。ボタンをクリックすると何も行われません。 –