我有tableViewCell和2 UICollectionView。第二个UICollectionView是第一部分的第二部分。第一个集合在DataSource数组中。如何将UICollectionViewCell设置为第二个UICollectionView?
或者我需要连接第二个UICollectionViews和DataSource?这不是个好消息,因为第一个UICollectionView是用于墙柱的。转贴第二名。
发布于 2014-04-14 17:26:13
如果要在同一个视图上使用两个UICollectionviews,那么控制器只需将它们的标记设置为0和1,并向UICollectionview委托方法添加检查,以便在填充来自模型的数据之前检查每个标记。
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if (collectionView.tag == 0)
{
//<<<DO Stuff for Collection view tagged 0 here >>>
}
}
else if (collectionview.tag == 1)
{
//<<<DO Stuff for Collection view tagged 1 here >>>
}和
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
if (collectionView.tag == 0)
{
// return <<<Return number of items in collectionview with tag 0>>>;
}
else
{
// return <<<Return number of items in collectionview with tag 1>>>;
}
}https://stackoverflow.com/questions/23065951
复制相似问题