Comments (9)
I don't understand what you mean. Can you explain your problem? ;-)
Maybe the following code helps:
UIView.performWithoutAnimation {
// updating the layout
}
from hfcardcollectionviewlayout.
In my app I have sometimes background update to my collection data. When this occurs I use collectionView.performBatchUpdates. I'd like to do this without calling animations.
I think this as more to to with the collection than your layout but I'm looking for pointers
from hfcardcollectionviewlayout.
UIView.performWithoutAnimation {
// updating the layout
}
is a good start.
from hfcardcollectionviewlayout.
The main issue I have is that the selection is not kept when I do an update. I tried to go around with disabling animation the manually selecting the previous selected item but the are still small flash.
My goal is when there is no selection it add a card like in the demo but when there is a selection the selection not changed and the row is added silently
from hfcardcollectionviewlayout.
An easy way to see what I'm fighting in the example is to replace :
if(self.colorArray.count == 1 || self.cardCollectionViewLayout!.revealedIndex >= 0) {
self.cardCollectionViewLayout?.unrevealCard(completion: {
self.colorArray.insert(self.getRandomColor(), at: index)
self.collectionView?.insertItems(at: [IndexPath(item: index, section: 0)])
})
} else {
self.colorArray.insert(self.getRandomColor(), at: index)
self.collectionView?.insertItems(at: [IndexPath(item: index, section: 0)])
}
with :
self.colorArray.insert(self.getRandomColor(), at: index)
self.collectionView?.insertItems(at: [IndexPath(item: index, section: 0)])
from hfcardcollectionviewlayout.
OK, now i know what you mean. :-)
But it's not so simple to fix.
from hfcardcollectionviewlayout.
To achieve the right behavior I have to create my own UICollectionView (extend) and overwrite some methods (insertItems(at indexPaths: [IndexPath])).
from hfcardcollectionviewlayout.
Can you post what works for you I'll extend the collection in my project so you don't have to change the structure of your lib
from hfcardcollectionviewlayout.
If you only have the problem for inserting items, with the new version you can use the HFCardCollectionView or copy the call of the helper method to your own class.
class HFCardCollectionView: UICollectionView {
override func insertItems(at indexPaths: [IndexPath]) {
if let collectionViewLayout = self.collectionViewLayout as? HFCardCollectionViewLayout {
collectionViewLayout.willInsert(indexPaths: indexPaths)
}
super.insertItems(at: indexPaths)
}
}
I hope this helps. ;-)
And you don't need the UIView.performWithoutAnimation{}
method if you just insert new items.
from hfcardcollectionviewlayout.
Related Issues (14)
- Collapse all card to top HOT 5
- Fix card's height
- cant make it work on swift 4.1 HOT 1
- Make animation variables public
- How can I detect when a card is being flipped?
- How can I know which side of a card is being shown?
- Disabling/controlling shadows?
- How to enable multiple section in this library?
- Strange behaviour on delete HOT 1
- Swipe is almost impossible in embedded table HOT 3
- iOS 11 contentInset cards under Navigation Bar HOT 1
- CocoaPod Install issue HOT 1
- Space at top for background view not observed when only one card HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hfcardcollectionviewlayout.