iOS UICollectionView 点击事件

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

UICollectionView 的 item 点击效果需要自己实现,系统提供了

  • (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath;
  • (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath;

//选中操作

  • (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {

} //取消选中操作

  • (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath {

}

ps: 点击效果需设置属性 self.collectionView.delaysContentTouches = false;

转载于:https://my.oschina.net/jack088/blog/829272

你可能感兴趣的:(iOS UICollectionView 点击事件)