Tableview cell contains Collection view. Easy delegate to get back the selected collection view item of selected tableview cell.
-
Clone/Download the master-repo.
-
Import
"RDColTeableCell"folder (.m/.h) into your project. -
Add
#import "RDColTeableCell/RDColTeableCell.h"
-
In you tableView's
cellForRowAtIndexPathimplement theRDColTableCellobject. -
Set cell's
datasourceanddelegateto yourviewcontroller.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
RDColTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
cell.datasource = self;
cell.delegate = self;
return cell;
}
- Implement the
datasourceanddelegatemethods.
- (UITableView *)collectionTableView {
// return tableview
}
- (void)selectedCollectionCellIndexPath:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath {
// indexPath.row - selected item of collectionview
// indexPath.section - selected row of tableview
}
- (Optional) You can also use cell's
collectionviewproperty to register collectionview cell.
[cell.collectionview registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
Please check the example included.
Suggestions/Queries/Feedbacks are welcome.
Feel free to contribute in anyway.
CHEERS!
