【发布时间】:2014-03-03 02:12:44
【问题描述】:
我有一个基本的 UICollectionView,如果我滚动它将“重绘”单元格顶部的标签,
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
cell.backgroundColor=[UIColor greenColor];
UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, cell.bounds.size.width, 40)];
[cell.contentView addSubview:title];
//NSString *titleLbl = [NSString stringWithFormat:@"i = %d", indexPath.row];
title.text = [self.arraya objectAtIndex:indexPath.row];
return cell;
}
如何修复它以便在滚动后刷新正确的单元格? 干杯
【问题讨论】: