UITableView和UICollectionView列表出现重叠问题
在使用UITableView或者UICollectionView的时候,当列表项ScrollView的显示范围的时候,如果刷新列表,可能会出现列表项重叠的现象。
解决方法:在DataSource代理方法 (UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 中加入以下代码。
while ([cell.contentView.subviews lastObject] != nil) {
[[cell.contentView.subviews lastObject]removeFromSuperview];
}
现在列表可以随意滑动,再也不会出现重叠现象了。