SwipeView icon indicating copy to clipboard operation
SwipeView copied to clipboard

SwipeView with CollectionView as Subview

Open WenchaoD opened this issue 10 years ago • 1 comments

I've set collectionView scrollenable to false, and delayContentTouches to false, shouldCancelContentTouchesInView to true, using swift , but the swipeView scroll will still be delayed

WenchaoD avatar Dec 17 '14 07:12 WenchaoD

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()
        }
    }

samuelbeek avatar Nov 25 '15 18:11 samuelbeek