剛開始以為是tableviewcell的重用機制的問題,
首先嘗試了方法:
ShopProFirstCell *cell = [tableView cellForRowAtIndexPath:indexPath];
if (cell == nil) {
cell = [[ShopProFirstCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryNone;
}
不起作用,又嘗試給每個cell設置不同的標識符:
NSString *identify = [NSString stringWithFormat:@"FirstCell%ld%ld",(long)[indexPath section],(long)[indexPath row]];
還是不起作用。。。
最后查看代碼發(fā)現(xiàn)在
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor whiteColor];
}
return self;
}
中不知怎么想的設置了cell的frame
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, paintViewHeight+height);
刪除之后問題解決。