小编San*_*jan的帖子

如何在xcode中的同一页面内制作两个collectionView?

我想UICollectionView在同一页面上有两个.两个UICollectionView将根据需要显示不同的数据.怎么做?先感谢您.

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *cellIdentifierHall2 = @"hall2";

    /* Uncomment this block to use subclass-based cells */
    timeCell *cell = (timeCell *)[myCollectionViewHall2 dequeueReusableCellWithReuseIdentifier:cellIdentifierHall2 forIndexPath:indexPath];

    [cell.timeButton setTitle:[[allSimilarMutableArray valueForKey:@"showTime"] objectAtIndex:indexPath.item] forState:UIControlStateNormal];


    return cell;

}

- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *cellIdentifierHall3 = @"hall3";

    /* Uncomment this block to use subclass-based cells */
    timeCell *cell = (timeCell *)[myCollectionViewHall3 dequeueReusableCellWithReuseIdentifier:cellIdentifierHall3 forIndexPath:indexPath];

    [cell.timeButton setTitle:[[allSimilarMutableArray valueForKey:@"showTime"] objectAtIndex:indexPath.item] forState:UIControlStateNormal];


    return cell;

}
Run Code Online (Sandbox Code Playgroud)

collectionview ios uicollectionviewcell

1
推荐指数
1
解决办法
5318
查看次数

标签 统计

collectionview ×1

ios ×1

uicollectionviewcell ×1