Comment gérer didSelectRowAtIndexPath de sorte qu'il fonctionne sur les trois cellules différentes pour chaque cellule dedans?J'ai une tableview avec plusieurs cellules dedans et dans chaque cellule ayant tableview, collectionview, tableview, comme ça
- (UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if([[dataArray[indexPath.row] valueForKey:@"type"] isEqual:@"Traffic" ])
{
if(!TrafficCell)
{
TrafficCell = [tableView dequeueReusableCellWithIdentifier:@"CollectionVIewTableViewCell" forIndexPath:indexPath];
NSDictionary *dict=dataArray[indexPath.row];
TrafficCell.Traffic = [dict valueForKey:@"detail"];
[TrafficCell.collectionView reloadData];
return TrafficCell;
}
return TrafficCell;
}
else if([[dataArray[indexPath.row] valueForKey:@"type"] isEqual:@"News"])
{
if(!NewsCell)
{
NewsTableViewCell *cell = (NewsTableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"NewsTableViewCell" forIndexPath:indexPath];
NSDictionary *dict=dataArray[indexPath.row];
cell.News = [dict valueForKey:@"detail"];
[cell.NewsTableView reloadData];
return cell;
}
return NewsCell;
}
else
{
if(!CategoryCell)
{
CategoryCell= [tableView dequeueReusableCellWithIdentifier:@"CategoryTableViewCell" forIndexPath:indexPath];
NSDictionary *dict=dataArray[indexPath.row];
CategoryCell.Category = [dict valueForKey:@"detail"];
[CategoryCell.CategorycollectionView reloadData];
return CategoryCell;
}
return CategoryCell;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
S'il vous plaît expliquer avec plus de détails? –
Dans la photo que j'ai téléchargé les données montrent comme olx, Naukri.com, ils sont en vue de collection et des données comme Rice en toute bonté sont dans tableview je veux qu'ils les transmettent à la webview. –
Ne pas implémenter didSelectRowAtIndexPath pour votre tableView principale. Au lieu de cela, créez des délégués pour TrafficCell, NewsCell, CategoryCell et gérez leurs fonctionnalités en conséquence. –