Reputation: 5832
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?
Or should I use tow different UICollectionView
separately? what is the best solution out there?
Also, I created UI programmatically. is not Storyboard.
Upvotes: 0
Views: 372
Reputation: 16446
As I mentioned in comment you have to take
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]];
}
Upvotes: 1