I have a UITableview
. One of the UITableViewCell's
is a UICollectionview
with instance name "amenityView". The UICollectionViewDelegate
and the UICollectionViewDataSource
are set in the storyboard
as shown below. The following methods get called and the data is populated as expected.
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- (UICollectionViewCell *)collectionView:(UICollectionView *)collection cellForItemAtIndexPath:(NSIndexPath *)indexPath
However, the methods below didn't get called when I select the UICollectionViewCell
contained in the UICollectionView
. What have I missed?
-(void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
-(void) collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
UPDATE:
return YES in this method collectionView:shouldSelectItemAtIndexPath:
will invoke the below two methods. At least that's what was missing on my part. Hope this will help some body...
.allowsSelection
" for your collection view set to YES? – GatesheadUICollectionView
is smaller than the table view cell. When I select the area outside theUICollectionView
but inside the table view cell the methoddidSelectRowAtIndexPath
gets called. So yes the selection of the cell works. – Woke