iOS UICollectionView 点击事件
2017-01-22 00:00
2296 查看
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;
(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;
相关文章推荐
- ios UIScrollView响应点击事件
- iOS 为自定义tableView添加button点击事件后获取其序号
- iOS给图片(其他view) 添加点击事件
- iOS实现UIImageView透明区域点击事件穿透
- iOS开发-UITableViewCell(UICollectionViewItem)需要两个手指点击或者长按才可以选中,解决办法
- iOS UIImageview 点击事件
- iOS实现UIImageView透明区域点击事件穿透
- ios学习笔记:UIAlertView使用和监听点击事件
- IOS -- 对UITableView的backgroundview的研究(ios7中backgroundView点击事件不响应)
- iOS开发-UIImageView响应点击事件
- iOS界面不能点击(tableView 的cell 不能使用点击事件,tableView也不能上下滚动)
- iOS:UIImageView添加点击事件
- IOS自定义View使用block实现点击事件
- iOS-UIAlertView的点击事件
- IOS为UIImageView图片添加点击事件
- iOS UITapGestureRecognizer手势和UIButton 以及UITabelView点击事件冲突
- 转自原文地址:IOS UIScrollview UIImageView点击事件处理
- iOS中UIAlertView的点击响应事件
- iOS关闭UITableView中cell的点击事件
- iOS实现UIImageView透明区域点击事件穿透