Ios UIButton以编程方式位于单元格内

Ios UIButton以编程方式位于单元格内,ios,objective-c,uicollectionview,Ios,Objective C,Uicollectionview,当我在UICollectionView的单元格类中放置UIButton时,目标是谁?我不能将target设置为“self”,但它必须是父collectionView,其中我没有指向cell类的指针 //inside a cell class (`uicollectionviewcell`) [self.deleteCell addTarget:self action:@selector(clearCell:)forControlEvents:UIControlEventTouchUpIn

当我在UICollectionView的单元格类中放置UIButton时,目标是谁?我不能将target设置为“self”,但它必须是父collectionView,其中我没有指向cell类的指针

//inside a cell class (`uicollectionviewcell`)


  [self.deleteCell addTarget:self action:@selector(clearCell:)forControlEvents:UIControlEventTouchUpInside];

应该用什么来代替
self

将目标添加到集合中,然后使用此方法将其自身添加到集合中:

   - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
在这里,我使用
cell.button进入该按钮,并将目标添加到self(即集合)