iOS开发中如何在UITableViewCell里面获得一个数组的元素?
代码self.appDelegate=[UIApplicationsharedApplication].delegate;DownLoadFoyue*foyue=[NSE...
代码
self.appDelegate = [UIApplication sharedApplication].delegate;
DownLoadFoyue * foyue = [NSEntityDescription insertNewObjectForEntityForName:@"DownLoadFoyue" inManagedObjectContext:_appDelegate.managedObjectContext];
Chanyue * chanyueModel = [_array objectAtIndex:indexPath.row];
if (_foyueArr != nil) {
//foyue = _foyueArr[indexPath.row];
for (foyue in _foyueArr) {
if ([foyue.soundName isEqualToString:chanyueModel.WY_SoundName] && _inte <= _foyueArr.count - 1) {
DownloadTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"downcell" forIndexPath:indexPath];
cell.foyue = _foyueArr[_inte];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
_inte ++;
return cell;
}
}
}
if (_inte == _foyueArr.count) {
_inte = 0;
}
ChanyueTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
cell.chanyueModel = _array[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; 展开
self.appDelegate = [UIApplication sharedApplication].delegate;
DownLoadFoyue * foyue = [NSEntityDescription insertNewObjectForEntityForName:@"DownLoadFoyue" inManagedObjectContext:_appDelegate.managedObjectContext];
Chanyue * chanyueModel = [_array objectAtIndex:indexPath.row];
if (_foyueArr != nil) {
//foyue = _foyueArr[indexPath.row];
for (foyue in _foyueArr) {
if ([foyue.soundName isEqualToString:chanyueModel.WY_SoundName] && _inte <= _foyueArr.count - 1) {
DownloadTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"downcell" forIndexPath:indexPath];
cell.foyue = _foyueArr[_inte];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
_inte ++;
return cell;
}
}
}
if (_inte == _foyueArr.count) {
_inte = 0;
}
ChanyueTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
cell.chanyueModel = _array[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; 展开
2015-05-27
展开全部
代码太多啦........
TableViewCell里面获得数组的元素.写一个循环不就搞定了吗,在创建单元格的时候,在Cell的方法里面写啊
TableViewCell里面获得数组的元素.写一个循环不就搞定了吗,在创建单元格的时候,在Cell的方法里面写啊
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询