UICollectionView Scrolling issue

*爱你&永不变心* 提交于 2019-12-22 18:25:10

问题


I am developing an iPhone app that consists of UICollectionViews on UITableView

To make each Collection scrolls horizontally . All steps are work perfectly except when I start to scroll each UICollectionView the UICollectionViewCell method is reuse and

I am getting a problem with the label , the problem in the image below

I faced this issue with the title of each collection on scrolling the table view and I did this

NSString *CellIdentifier = [NSString stringWithFormat:@"CellId%d%d",indexPath.row,indexPath.section];
TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell) 
{ 
    cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
} 

I assigned unique identifier to each cell , there is any suggestions that can help ? :)


回答1:


Add this code in cellForRoAtIndexPath methods

for (UIView *v in [cell subviews])
        [v removeFromSuperview];

Tell me if its working or not :)



来源:https://stackoverflow.com/questions/22325552/uicollectionview-scrolling-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!