![](/img/trans.png)
[英]How to change image of UIImageView that is inside a UIButton programmatically?
[英]UIButton inside cell programmatically
當我將UIButton放在UICollectionView的單元格類中時,目標是誰? 我不能將target設置為“ self”,但是它必須是父collectionView,在其中我沒有指向單元格類的指針。
//inside a cell class (`uicollectionviewcell`)
[self.deleteCell addTarget:self action:@selector(clearCell:)forControlEvents:UIControlEventTouchUpInside];
代替self
應該是什么?
在此方法上將目標自身添加到集合中:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
我用cell.button
進入那個按鈕的cell.button
,然后將目標添加到self(這是集合)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.