单击按钮时,我想更改按钮(UIButton
在里面UICollectionViewCell
)文本。如何获得单元格和按钮?我有一个自定义单元格。
[cell.shareButton addTarget:self action:@selector(shareAction:) forControlEvents:UIControlEventTouchUpInside];
-(void)shareAction:(UIButton*)button {
NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint: [self.collectionView convertPoint:button.center fromView:button.superview]];
NSLog(@"row %d",indexPath.row);
NSLog(@"section %d",indexPath.section);
}