SwipeView
SwipeView copied to clipboard
SwipeView with CollectionView as Subview
I've set collectionView scrollenable to false, and delayContentTouches to false, shouldCancelContentTouchesInView to true, using swift , but the swipeView scroll will still be delayed
I've done this too. Set the ViewController that contains the swipeView
as UICollectionViewDataSource
. Then do cell for item at index path based on the currentItemIndex
, like this:
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return events[swipeView.currentItemIndex].attendingUsers.count
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! UserCell
cell.imageView.setImageFromURL(events[swipeView.currentItemIndex].attendingUsers[indexPath.row].imgUrl)
return cell
}
Make your ViewController also a SwipeViewDelegate
and add this function:
func swipeViewCurrentItemIndexDidChange(swipeView: SwipeView!) {
if let cell = swipeView.itemViewAtIndex(swipeView.currentItemIndex) as? Cell {
cell.userCollectionView!.reloadData()
cell.layoutSubviews()
}
}