UICollectionView滚动问题 [英] UICollectionView Scrolling issue

查看:62
本文介绍了UICollectionView滚动问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个iPhone应用程序,该应用程序由 UITableView

上的 UICollectionViews 组成

使每个Collection水平滚动.除了我开始滚动每个 UICollectionView 时,所有步骤都可以正常工作,而 UICollectionViewCell 方法是重用和

我遇到标签问题,下面的图像中的问题

在滚动表格视图时,我遇到了每个集合的标题的问题,我做到了

  NSString * CellIdentifier = [NSString stringWithFormat:@"CellId%d%d",indexPath.row,indexPath.section];TableViewCell * cell =(TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];如果(!单元格){单元格= [[TableViewCell分配] initWithStyle:UITableViewCellStyleDefault重用Identifier:CellIdentifier];} 

我为每个单元分配了唯一标识符,有什么建议可以帮助您吗?:)

解决方案

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

这篇关于UICollectionView滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆