Aashay
Aashay

Reputation: 383

How to animate an ImageView without animating its subView in iOS

I have two UIImageViews called feedView and feedImageIcon. feedImageIcon is a subView of feedView. I am performing a CABasicAnimation with keyPath @"transform.scale.xy" on feedView. This animation affects feedImageIcon as well.

How do I perform the animation on feedView without animating feedImageIcon?

I tried adding feedImageIcon as feedView's subView in the completion of [UIView transitionWithView.....] but it still animates feedImageIcon.

Any help will be appreciated! Thank you in advance!

Upvotes: 0

Views: 54

Answers (1)

Aashay
Aashay

Reputation: 383

Thanks to @beyowulf and @ShahiM! I was not aware that it is not a good practice to place an UIImageView as a subView of another UIImageView.

I added feedImageIcon as a subView to self.view and called bringSubviewToFront.

Works exactly how I want it to.

Thanks again!

Upvotes: 0

Related Questions