Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS UITableViewCell在滚动后未正确更新_Ios_Objective C_Iphone_Uitableview - Fatal编程技术网

iOS UITableViewCell在滚动后未正确更新

iOS UITableViewCell在滚动后未正确更新,ios,objective-c,iphone,uitableview,Ios,Objective C,Iphone,Uitableview,我有一个带有自定义UITableViewCell的TableView,它从一个可变数组加载数据 在我的cellForRow中:我调用代码用数组中的数据绘制一个子视图,当我向下和向上滚动时,该子视图看起来非常错误,但每个标签看起来都是正确的 我尝试了很多关于谷歌的答案,但都没有解决问题,我甚至将子视图放到了数组中,但也不起作用,很抱歉,我还不能发布图像:( NSMutableArray*mintHistoryList=//Epin对象数组 -(UITableViewCell*)tableView:

我有一个带有自定义UITableViewCell的TableView,它从一个可变数组加载数据

在我的cellForRow中:我调用代码用数组中的数据绘制一个子视图,当我向下和向上滚动时,该子视图看起来非常错误,但每个标签看起来都是正确的

我尝试了很多关于谷歌的答案,但都没有解决问题,我甚至将子视图放到了数组中,但也不起作用,很抱歉,我还不能发布图像:(

NSMutableArray*mintHistoryList=//Epin对象数组
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@“cell”forIndexPath:indexPath];
//配置单元格。。。
对象*数据;
if(indexath.row
数组不变,其他标签也不变,只有子视图不正确

正确:

上下滚动:

我认为问题在这里

UIView *circleView = (UIView *)[cell viewWithTag:104];
[circleView addSubview:[Customview alloc]initWithOriginal:data.pinOriginalAmount andLeft:data.pinLeftAmount];  
当您将重复使用单元格时,它将包含2个圈视图。。。 您应该删除上一个,或者重新使用circleView本身


PS图像不适用于我,我收到错误403

状态栏是什么字体?:DShow你的单元格的初始化和修复链接,plshow我可以重用它吗?我知道它在那里,但我找不到方法。看起来单元格渲染很慢,导致错误,谢谢,修复了错误links@Tj3n只需在添加新内容之前清除circleView即可子视图:
[[circleView子视图]makeObjectsPerformSelector:@selector(removeFromSuperview)]
谢谢,我把它放在UIView*circleView=(UIView*)[cell viewWithTag:104]下,它很有效!还有一件事!:)使用viewWithTag是一种不好的做法。通常你应该从UITableViewCell继承你自己的单元格,并使用一些方法,如:[myCell setPinNumber:number];[myCell pinLeftValue:value];等等。。。
UIView *circleView = (UIView *)[cell viewWithTag:104];
[circleView addSubview:[Customview alloc]initWithOriginal:data.pinOriginalAmount andLeft:data.pinLeftAmount];