Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent layoutSubviews being called when transforming sublayers?

I have some Layer1 attached to the root layer of my custom view as sublayer.

And then this funny thing happens that when I have changed the transform of Layer1 inside touchesMoved, layoutSubviews is called.

I know there are all kinds of way to bypass this. But what's the logic behind it? Can it be prevented, instead of that I need find walk arounds?

like image 209
BlueWanderer Avatar asked Sep 11 '25 13:09

BlueWanderer


1 Answers

Unfortunately, it doesn't seem to be preventable.

My usual solution is to add another view to the hierarchy in between the parent and the child. The new view essentially works as a dummy container and does nothing on its layoutSubviews.

like image 191
Bartosz Ciechanowski Avatar answered Sep 14 '25 02:09

Bartosz Ciechanowski