我有一个 uitableview,我有一个带有 imageView 的自定义单元格。imageView 已经填充了图像,但其.hidden
属性设置为YES
。这意味着当 tableView 存在时,所有单元格图像都将隐藏。在应用程序中,您可以设置图像的开/关。这只是一点点信息。我的问题是我需要遍历 tableViewCells 并查看是否隐藏了任何图像。
在cellForRowAtIndexPath:
我尝试循环遍历单元格。
BOOL cellImageViewsAreHidden = YES;
for (UITableViewCell *myCell in tableView.visibleCells) {
if (self.cell.alert.hidden == NO) {
cellImageViewsAreHidden = NO;
break;
}
else{
cellImageViewsAreHidden = YES;
}
}
if (cellImageViewsAreHidden == NO) {
NSLog(@"They are visible");
}
else{
NSLog(@"they are hidden");
}
但这不幸而已NSLogs
"they are hidden"
。NSLog
即使有图像可见,它也不会是正确的文本。非常感谢任何帮助或建议!