[英]One custom cell in UICollectionView swift
I have a page in my App with a slider on top and a repeated list on the bottom. 我的应用程序中有一个页面,顶部有一个滑块,底部有一个重复列表。 now I'm looking for a solution that can be done this entire UI with a single
UICollectionView
, is that possible to have a single cell with custom design and dataSoruce from other cells? 现在,我正在寻找一种可以通过单个
UICollectionView
完成整个UI的解决方案,是否可以将单个单元格与其他单元格一起进行自定义设计和dataSoruce?
Or should I use tow different UICollectionView
separately? 还是应该分别使用两个不同的
UICollectionView
? what is the best solution out there? 最好的解决方案是什么?
Also, I created UI programmatically. 另外,我以编程方式创建了UI。 is not Storyboard.
不是情节提要。
As I mentioned in comment you have to take 正如我在评论中提到的,您必须
In section one pass items : 1 在第一部分中,合格项目:1
In Section two pass items: Array count 在第二个通过项目中:数组计数
gallery here is sample code 图库是示例代码
GalleryCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kGalleryCell forIndexPath:indexPath];
if (cell.gestureRecognizers.count <= 0) {
UISwipeGestureRecognizer *swipeNext = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(cellDidSwipe:)];
swipeNext.direction = UISwipeGestureRecognizerDirectionLeft;
UISwipeGestureRecognizer *swipePrev = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(cellDidSwipe:)];
swipePrev.direction = UISwipeGestureRecognizerDirectionRight;
[cell setGestureRecognizers:@[swipeNext,swipePrev]];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.