How to make parallax cell not effect text?
JayceBryce opened this issue · 3 comments
Right not it seems like the Parallax effects the background of the cell and what's in front. I was wondering if there is a way to change this so the text on the cell is not effected by Parallax? Therefore the "Text/UILabel" does not move with the Parallax as you scroll?
I'm not 100% sure if I understand you. If you could provide some sort of illustration that would be nice.
Regardless, your assumption is correct. The parallax effect this library provides is by moving the contentView
of the cell slower (hence travel longer) than the cell itself. So basically if you have two elements say a label and an icon, you can put one in the contentView
and another in backgroundView
and what you'll get is that the one in the contentView
will move slower (the parallax effect) and the one in the backgroundView
will move together with the cell.
In your case, if you want some text not moving with the parallax then putting it in the backgroundView
instead of contentView
.
@KelvinJin Thanks for replying. I am using your sample project and here is an illustration of what I mean:
In your sample project, both the textLabel
and background color is in the contentView
. Because of this everything has the parallax effect.
You said above that I can add items to a backgroundView
and that will not have the parallax effect. I am not sure how to do this. How would you put the textLabel
outside of the contentView
so it has no parallax effect? Please use your sample project as an example.
Check parallax-demo
branch. It's all about how much you know about UICollectionViewCell to be honest.