- (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
{
}
{
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
{
}
解决方案 »
- IOS消息推送
- 问个语法问题 <UIScrollViewDelegate>的左右符号是什么意思
- 在iOS中怎么实现UDP封装数据包,然后发送到目的主机
- 怎样在iphone 3gs 中不影响现有程序运行的情况下,实现 自动后台截屏功能
- 会c++和一点object-c,开发微信公众服务号,怎么个流程?
- 求: iOS单手指旋转View
- ios代码,如何实现点击一个button让uiview里面的控件消失,请进来看下
- IOS 修改按钮的背景颜色
- 或许这个问题会占用大神们的一点点时间 但对我这个新手来说简直可以省去太多精力 谢谢
- UIAlertView为什么可以不遵守协议就能实现代理方法?
- app审核被拒,好像是音频原因,大神帮忙看看
- 自己写了个小计算器 不太懂oc 实在不知道错在哪里 求大神帮助
1.最正常的办法:适用于页面是静态的不会有改变,直接判断indexpath的row和section来写点击事件
2.也可以用的办法:适用于每个cell动态创建但保有指针的情况,可以判断一个 cell是否等于被点击的cell(调用cellForRowAtIndexPath这个方法就能得到被点击的cell的指针了),如果是就做处理