我的应用程序中有一个页面,顶部有一个滑块,底部有一个重复的列表。 现在我正在寻找一个可以通过单个UICollectionView整个UI中完成的解决方案,是否可以从其他单元格中获得具有自定义设计和dataSoruce的单个单元格?
这是我的设计:
或者我应该单独使用两个不同的UICollectionView ? 什么是最好的解决方案?
另外,我以编程方式创建了UI。 不是故事板。
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?
Here is my design:
Or should I use tow different UICollectionView separately? what is the best solution out there?
Also, I created UI programmatically. is not Storyboard.
最满意答案
正如我在评论中提到的,你必须采取
一个集合视图 两节第一节通过项目:1
在第二节中传递项:数组计数
这里的图库是示例代码
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]]; }As I mentioned in comment you have to take
One collection view Two SectionsIn section one pass items : 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]]; }更多推荐
发布评论