|
Hey guys. Cut to the chase. Trynna create some cells in my CollectionView. Cells will populate with the object of type Tweet. Some Tweet(s) has urlToExpand, some has value nil. Based on that, button "See more" will be visible or nah. I am certain that the data is passed correctly into Cell as I have checked it with the print. However button works randomly. Sometimes it does display, sometimes it doesn't. I have no idea why. Here is my dataSource update in VC
Here is the function from collectionViewCell that I am calling in my cv while populating cells.
Many thanks for any help. |
|
Hi, you sure the |
|
Hey Filip, thanks I ve changed that to isHidden property. But it did not change that strange behaviour. Any other suggestions? Many thanks |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure and A/B test your entire paywall UI without any code changes or app updates. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
My guess is that you need to setup/reset your cell properly in the prepareForReuse method of your custom cell class. There you have you make sure the button is added on reuse when needed. And I agree with Filip, I would hide / show the button, instead of removing it all together!
Hope this helps! |
|
|
|
Hey guys, thanks for help! Gakkienl, do you mean that?
Sadly cell still behaves the same way. Buttons do not follow conditional as they suppose to. Or am I doing it wrong? |
|
|
|
Yes, my vote is also for removing the Because with this |
|
Hey lads, Not sure actually why I had it. Before, the code was placed in a function I lost Dispatch Queue but the cells behave same way as they did..
Any suggestions? |
|
Yes, I somehow missed it previously. In |
|
|
|
Sure. The Generally if you have for example Suppose you had this code:
Once your code would hit the So the pattern is that in your You can also just set |
|
Worked like a dream! For interested here is the solution: Function set in collectionViewReusableCell, called when configuring data source from VC:
Function prepareForReuse from collectionViewReusableCell:
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure and A/B test your entire paywall UI without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.