Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Strange behaviour on delete #3

Closed
Alex293 opened this issue Mar 13, 2017 · 1 comment
Closed

Strange behaviour on delete #3

Alex293 opened this issue Mar 13, 2017 · 1 comment

Comments

@Alex293
Copy link

Alex293 commented Mar 13, 2017

If i delete a card while it's flipped the card will disappear and another card will be considered as flipped and will be flipped back. Everything works as expected but we can see a flip animation on the top stacked card which feels weird.

@hfrahmann
Copy link
Owner

New code to delete a card. The completion block of _ flipRevealedCardBack_ is also called when the card is not flipped.

var index = 0
if(self.cardCollectionViewLayout!.revealedIndex >= 0) {
    index = self.cardCollectionViewLayout!.revealedIndex
}
self.cardCollectionViewLayout?.flipRevealedCardBack(completion: {
    self.colorArray.remove(at: index)
    self.collectionView?.deleteItems(at: [IndexPath(item: index, section: 0)])
    self.cardCollectionViewLayout?.unrevealCard(completion: {
        if(self.colorArray.count == 1) {
            self.cardCollectionViewLayout?.revealCardAt(index: 0)
        }
    })
})

It should now look like this:

hfcdeletefast

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants