首页 > 一个view上面放两个不同的collectionview

一个view上面放两个不同的collectionview

一个view上面放两个collectionview 而且注册的不同 但是最后只有第一个collectionview 上的cell能显示出来, 第二个显示不出来 是什么情况?

-(void)setTitleCollectionView
{

UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
flowLayout.itemSize = CGSizeMake(20.0f, 20.0f);
flowLayout.minimumLineSpacing = 10;
flowLayout.minimumInteritemSpacing = 20;
flowLayout.sectionInset = UIEdgeInsetsMake(12.5f, 9.5f, 12.5f, 9.5f);


self.collectImageArray = [[UICollectionView alloc] initWithFrame:CGRectMake(0, [GeneralMethods handlerView_Y_And_Height:cycleImage], self.view.width, 45.0f) collectionViewLayout:flowLayout];
self.collectImageArray.showsVerticalScrollIndicator = NO;
self.collectImageArray.showsHorizontalScrollIndicator = NO;
self.collectImageArray.delegate = self;
self.collectImageArray.dataSource = self;
self.collectImageArray.backgroundColor = [UIColor clearColor];
[_collectImageArray  registerClass:[HTYKLM_TitleCell class] forCellWithReuseIdentifier:CollectionPublishTitleIdentifier];
[self.scrollView addSubview:self.collectImageArray];

}

-(void)setBottomTableCollectionView
{

UICollectionViewFlowLayout *flowLayout1 = [UICollectionViewFlowLayout new];
[flowLayout1 setScrollDirection:UICollectionViewScrollDirectionHorizontal];
flowLayout1.itemSize = CGSizeMake(self.view.width, 200);
flowLayout1.minimumLineSpacing = 0.1;
flowLayout1.minimumInteritemSpacing = 0.1;
flowLayout1.sectionInset = UIEdgeInsetsMake(0.1, 0.1, 0.1, 0.1);
////
self.collectTable = [[UICollectionView alloc] initWithFrame:CGRectMake(0, [GeneralMethods handlerView_Y_And_Height:self.collectImageArray], self.view.width, self.view.height + 118) collectionViewLayout:flowLayout1];
self.collectTable.pagingEnabled = YES;
self.collectTable.showsHorizontalScrollIndicator = NO;
self.collectTable.showsVerticalScrollIndicator = NO;
self.collectTable.delegate = self;
self.collectTable.dataSource = self;
self.collectTable.backgroundColor = [UIColor grayColor];
[_collectTable registerClass:[HTYKLM_TableViewCollectionViewCell class] forCellWithReuseIdentifier:@"TableViewCell"];
[self.scrollView addSubview:self.collectTable];

}
这是我两个collectionview的创建

if ([collectionView isEqual:self.collectTable]) {

    HTYKLM_TableViewCollectionViewCell *cell = (HTYKLM_TableViewCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"TableViewCell" forIndexPath:indexPath];
    //        cell.backgroundColor = [UIColor redColor];

// cell.backgroundColor = [UIColor blueColor];

    return cell;
}
else
{
    HTYKLM_TitleCell *cell = (HTYKLM_TitleCell *)[collectionView dequeueReusableCellWithReuseIdentifier:CollectionPublishTitleIdentifier forIndexPath:indexPath];
            cell.backgroundColor = [UIColor redColor];
    return cell;
}

}

【热门文章】
【热门文章】