jjzjj

didSelectItemAtIndexPath

全部标签

ios - 在 UITextView 上点击时不调用 UICollectionView didSelectItemAtIndexPath

我有一个带有自定义单元格的UICollectionView-它们有一个主要覆盖整个单元格的UITextView。这在使用didSelectItemAtIndexPath时会出现问题。触发它的唯一方法是点击UITextView外部。我希望它在您点击的单元格中的任何位置触发,无论是否有TextView。如何做到这一点? 最佳答案 didSelectItemAtIndexPath在collectionViewCell的subview都没有响应该触摸时被调用。由于textView响应这些触摸,所以它不会将这些触摸转发到它的superView

ios - 在 didSelectItemAtIndexPath 中更改 UICollectionViewCell 的属性

我在子类中配置一个UICollectionViewCell,它向contentView属性添加了2个subview,都是UIImageView并且都有hidden属性设置为YES。这些subview是“已选中”和“未选中”的图像,它们覆盖单元格中的主UIImageView,以指示当前单元格是否使用UICollectionView的“多选”功能被选中。点击单元格时,将在委托(delegate)上调用collectionView:didSelectItemAtIndexPath:,我想在“选中的”UIImageView上设置setHidden:NO。在单元格上调用它根本没有任何作用——单元

ios - 调用 didHighlightItemAtIndexPath 而不调用 UICollectionView 的 didSelectItemAtIndexPath

我有一个UICollectionView,我在其中覆盖了hitTest:withEvent:在我的UICollectionViewCells中,以便允许在单元格外的点击注册为单元格上的点击。当我执行此操作并点击现在注册为点击的单元格外部时,我收到了对didHighlightItemAtIndexPath和didUnhighlightItemAtIndexPath的调用,但没有收到对didSelectItemAtIndexPath的调用。如果我在单元格内部点击,我会像以前一样获得所有预期的突出显示和选择项目调用。我没有设置任何自定义手势识别器,也没有覆盖touchesBegan或类似的东

ios - Swift:如何在 UITableViewController(包含 UICollectionView)中使用 "didSelectItemAtIndexPath"?

我有一个UITableViewController,在TableViewCell里面,它是一个UICollectionView。我想在用户点击单元格时将数据从CollectionViewCell传递到DetailViewController。我将CollectionViewCell的segue拖到DetailViewController,并在TableViewCell中使用了didSelectItemAtIndexPath(其中包含CollectionView),并且有效。classTableViewCell:UITableViewCell,UICollectionViewDataSo

ios - didSelectItemAtIndexPath 在 Collection View Swift 中不起作用

我一直在开发一个新应用程序,它在CollectionView中显示Gif。我还为我的CollectionView中的单元格使用自定义CollectionView单元格类。虽然方法didSelectItemAtIndexPath不起作用...funccollectionView(collectionView:UICollectionView,didSelectItemAtIndexPathindexPath:NSIndexPath){println("itworked")//^thisdidnotprint}我该如何更改它,以便我可以使用手势识别器获取被点击项目的indexPath?

ios - didSelectItemAtIndexPath 未在同一屏幕上使用多个 Collection View 调用

我在同一个屏幕上有2个CollectionView,并且我在同一个ViewController中为它们实现了数据源和委托(delegate)。但是,didSelectItemAtIndexPath等委托(delegate)方法只被调用一次。其他信息:两个CollectionView都有一个带有图像的单元格。AllowSelection和UserInteractionEnabled在两个CollectionView中都设置为true在图像上启用用户交互委托(delegate)和数据源在Storyboard上从两个CollectionView到ViewController设置Collect

ios - Swift:UICollectionViewCell didSelectItemAtIndexPath 改变背景颜色

我可以很容易地在CellForItemAtIndexPath方法中更改单元格的背景颜色funccollectionView(collectionView:UICollectionView,cellForItemAtIndexPathindexPath:NSIndexPath)->UICollectionViewCell{cell.backgroundColor=UIColor.blackColor()}但是,当我尝试更改DidSelectItemAtIndexPath中的颜色时,它不起作用。funccollectionView(collectionView:UICollectionVi

ios - UICollectionView 仅在用户双击时调用 didSelectItemAtIndexPath,当用户单击时不会调用

我有一个大约屏幕大小的UICollectionView。它显示的UICollectionViewCells与collectionView的大小相同。每个单元格都有一个UIImage,它是单元格的大小。CollectionView启用了分页功能,因此本质上它是一个用户可以滑动浏览的全屏照片幻灯片。问题是-(void)collectionView:(UICollectionView*)collectionViewdidSelectItemAtIndexPath:(NSIndexPath*)indexPath只有当用户用两根手指点击单元格或用一根手指长按然后释放时才会调用。它似乎没有单击选择

关于 ios:collectionView didSelectItemAtIndexPath 与发送图片

collectionViewdidSelectItemAtIndexPathwithsendingimages我正在收藏视图中显示图像。当我选择特定单元格时,详细图像将显示在另一个视图控制器中。委托方法是didSelectItemAtIndexPath。请帮帮我。123456789101112recipeImages=[NSArrayarrayWithObjects:@"img2.png",@"img.png",@"img1.png",@"img3.png",@"img4.png",@"img5.png",@"img6.png",@"img7.png",nil];-(UICollectionV

关于 ios:collectionView didSelectItemAtIndexPath 与发送图片

collectionViewdidSelectItemAtIndexPathwithsendingimages我正在收藏视图中显示图像。当我选择特定单元格时,详细图像将显示在另一个视图控制器中。委托方法是didSelectItemAtIndexPath。请帮帮我。123456789101112recipeImages=[NSArrayarrayWithObjects:@"img2.png",@"img.png",@"img1.png",@"img3.png",@"img4.png",@"img5.png",@"img6.png",@"img7.png",nil];-(UICollectionV