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
cellForRowAtIndexPath
implement theRDColTableCell
object. -
Set cell's
datasource
anddelegate
to 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
datasource
anddelegate
methods.
- (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
collectionview
property 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!