用CollectionView画了一个课程表界面,但是在上下滑动以后前面的第几节课的标号会出现“残影”。
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
UILabel *classNum = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 25, CellHieght)];
if (indexPath.row == 0) {
cell.backgroundColor = [UIColor whiteColor];
classNum.text = [NSString stringWithFormat:@"%ld", indexPath.section + 1];
classNum.font = [UIFont systemFontOfSize:12];
classNum.textAlignment = NSTextAlignmentCenter;
[cell addSubview:classNum];
}
else{
cell.backgroundColor = [UIColor lightGrayColor];
}
return cell;
还请各位指教,个人感觉应该是没有reuse的问题
GitHub地址在这: https://github.com/DavidHu0921/ClassBoxForCityDLUT
问题代码在Controller/ClassCalendar/test里面