UICollectionView ItemSelected 不触发
UICollectionView ItemSelected does not trigger
This is for Xamarin.iOS
Sorry for confusion this is not for Objective-C but for C# Xamarin.iOS ,
I already had the tags for Xamarin.
从 2014 年开始,整个互联网似乎都在说 ItemSelected 没有在 UICollectionView 上触发。
除了使用 TouchesBegan、TouchesEnded 之外,还有其他解决方案吗?
我还注意到 CellDisplayingEnded() 也没有触发!!
Answering my own question: Instead of setting up a "Source" for the
table view , I've set it as a "DataSource" by mistake and those
methods were are never called.
可以用UICollectionViewDelegate
方法,
UICollectionViewDelegate
协议定义了允许您管理集合视图中项目选择的方法。当用户选择一个项目时, collectionView:didSelectItemAtIndexPath: 方法被调用。
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
}
这可能对您有所帮助
回答我自己的问题。我没有为 table 视图设置 "Source" ,而是错误地将其设置为 "DataSource" 并且这些方法永远不会被调用
This is for Xamarin.iOS
Sorry for confusion this is not for Objective-C but for C# Xamarin.iOS , I already had the tags for Xamarin.
从 2014 年开始,整个互联网似乎都在说 ItemSelected 没有在 UICollectionView 上触发。 除了使用 TouchesBegan、TouchesEnded 之外,还有其他解决方案吗?
我还注意到 CellDisplayingEnded() 也没有触发!!
Answering my own question: Instead of setting up a "Source" for the table view , I've set it as a "DataSource" by mistake and those methods were are never called.
可以用UICollectionViewDelegate
方法,
UICollectionViewDelegate
协议定义了允许您管理集合视图中项目选择的方法。当用户选择一个项目时, collectionView:didSelectItemAtIndexPath: 方法被调用。
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
}
这可能对您有所帮助
回答我自己的问题。我没有为 table 视图设置 "Source" ,而是错误地将其设置为 "DataSource" 并且这些方法永远不会被调用