刚开始的时候,一切正常
拖动tableview一下后,就变成这样了
看了网上的一些帖子,说是重用的问题 ,然后修改了代码如下
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *result = nil;
static NSString *cellIdentifier = @"cell";
result = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (result == nil) {
result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}else{
//如果result不为空,删除它的所有子视图
while ([result.contentView.subviews lastObject]!= nil) {
[[result.contentView.subviews lastObject] removeFromSuperview];
}
}
//下面是自定义视图
但是问题依旧,还是重叠
请问这是什么问题,怎么解决?