gpt4 book ai didi

ios - UICollectionView 滚动问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:07:04 25 4
gpt4 key购买 nike

我正在开发一个 iPhone 应用程序,它包含 UITableView 上的 UICollectionViews

使每个集合水平滚动。所有步骤都完美无缺,除了当我开始滚动每个 UICollectionViewUICollectionViewCell 方法被重用和

我的标签有问题,下图中的问题 enter image description here

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

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];
}

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

最佳答案

cellForRoAtIndexPath 方法中添加这段代码

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

告诉我它是否有效:)

关于ios - UICollectionView 滚动问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22325552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com