Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subviewsParallaxMode not working properly in UICollectionViewCell #3

Closed
stefanomondino opened this issue Mar 30, 2017 · 5 comments
Closed

Comments

@stefanomondino
Copy link
Contributor

I would like to achieve some subview parallax effect in my custom collection view cells (created in a xib file).
I have a UIImageView covering all the cell's space, with some text on top.
The cell is a ParallaxCollectionViewCell subclass, and I'd like to use .basedOnTag mode.
This kind of behavior is currently not possible

in
public func addParallaxMotionEffects(with options: inout ParallaxEffectOptions)
the interpolation causing the parallax effect is applied to all the (first level) subviews, but a collection view cell only has one subview (the content view). All my subviews are inside the system-defined content view, so the intended effect will never be able to work properly.
I'd like to change the subviews property used at line 87 (and 120) of UIView+ParallaxEffect
subviews .filter { $0 !== options.glowContainerView } .enumerated() .forEach { (index: Int, subview: UIView) in

to something like this
let subviews = (self as? ParallaxCollectionViewCell)?.contentView.subviews ?? self.subviews

Does this make sense?

@stefanomondino
Copy link
Contributor Author

stefanomondino commented Mar 30, 2017

#4 here's an implementation with customizable container

@nonameplum
Copy link
Contributor

@stefanomondino Thanks for you contribution and pr. Instead of using inheritance I would like to stick with composition using existing ParallaxEffectOptions struct that is used for this purpose. Please take a look at the changes that I have made and please let me know if that will work you.

https://github.com/PGSSoft/ParallaxView/compare/pr/4

@stefanomondino
Copy link
Contributor Author

Thanks, I total agree with your solution. I'll try it out in few days but seems good to me. Thank you very much:)

@stefanomondino
Copy link
Contributor Author

works like a charm! can you please merge it and release it?

@nonameplum
Copy link
Contributor

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

No branches or pull requests

2 participants