简体   繁体   中英

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?

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.

As I mentioned in comment you have to take

  1. One collection view
  2. Two Sections

In 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]];
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM