Reputation: 1015
I have a custom view with a grid-like layout. When I touch each subview I want to animate them. The superview overrides layoutSubviews
to create the grid of subviews.
The problem is whenever I change the frame of a subview for animation, the superview's layoutSubviews method is called overwriting the frame and no animation happens.
Why does layoutSubviews get called in this scenario and how can I prevent it?
There are other questions similar to this, but none of them have been properly answered.
Thanks!
Upvotes: 0
Views: 755
Reputation: 1015
I ended up adding a flag property on my superview and then set it to YES from my subview to prevent it from laying out subviews. Seems very hacky but it works.
Upvotes: 1