如何在同一个视图控制器上使用两个CollectionView逐个滚动 [英] how to use two CollectionView on same view controller scroll one by one

查看:89
本文介绍了如何在同一个视图控制器上使用两个CollectionView逐个滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会尝试在同一个视图控制器上设置集合视图,但是在运行时它会显示SIGABRT信号错误,所以请告诉我如何在同一个视图控制器上添加到集合视图?

I would try to set to the collection view on the same view controller, but at runtime it shows the error of signal SIGABRT error so please tell me what can I do to add to the collection view on the same view controller?

推荐答案

您可以通过拖动在单个视图控制器中添加两个集合视图。

You can add two collection view in a single view controller by dragging it.

但您必须验证UI收集视图,如

but you have to validate UIcollection view like

func collectionView(collectionView: UICollectionView,
        cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {  
    var cell = HomeCollectionViewCell()

if(collectionView == self.collName1)
            {  
    cell = collName.dequeueReusableCellWithReuseIdentifier("CellIdentifier", forIndexPath: indexPath) as! HomeCollectionViewCell  
}  
else  
if(collectionView == self.collName2)  
{}     
return cell
}   

这篇关于如何在同一个视图控制器上使用两个CollectionView逐个滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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