且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

UICollectionView滚动问题

更新时间:2022-10-15 08:57:44

cellForRoAtIndexPath 方法中添加此代码

 用于([单元格子视图]中的UIView * v)[v removeFromSuperview]; 

告诉我是否可行:)

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 ? :)

Add this code in cellForRoAtIndexPath methods

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

Tell me if its working or not :)