Loo*_*zie 7 uitableview uicollectionview uicollectionviewcell uicollectionviewdelegate
我有一个UITableview
.其中一个UITableViewCell's
是UICollectionview
实例名称"amenityView".的UICollectionViewDelegate
和UICollectionViewDataSource
在所设定的storyboard
下面,如图所示.调用以下方法并按预期填充数据.
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- (UICollectionViewCell *)collectionView:(UICollectionView *)collection cellForItemAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
但是,当我选择UICollectionViewCell
包含在中的包含时,下面的方法没有被调用UICollectionView
.我错过了什么?
-(void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
-(void) collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
UPDATE:在此方法中返回YES collectionView:shouldSelectItemAtIndexPath:
将调用以下两个方法.至少那是我所缺少的.希望这会对一些身体有所帮助......
表视图的 didSelectRowAtIndexPath 是否被调用?如果是这样,表视图可能会拦截触摸,而不会将它们传递到内部的集合视图。我从未完成过您想要执行的解决方案,但是集合视图位于滚动视图内,并且以有意义的方式将触摸信息传递到集合视图可能并不容易,因此您可能需要禁用点击表视图单元格,以便集合视图响应触摸。
归档时间: |
|
查看次数: |
6596 次 |
最近记录: |