I have the following set up. I have a UIView
called parentView
that holds a UIView
called childView
. parentView
can be rotated and resized using some touch gestures which need to be on the parentView
. childView
has some drawing code in its drawRect method which needs to updated as the parentView
is transformed.
I am noticing when I transform the parentView
(scale or rotate), childView
automatically gets transformed as well. Problem with this is, while I do want the rotate transform to be initiated on the childView
, I don't want it to be scale, I'd rather execute its drawing code.
So my question is, what is a good way to handle this situation? I notice when I call "setNeedsDisplay
" on my childView
after parentView
is transformed, it doesn't get executed.
I had to apply the rotation to the parentView
, and then set the bounds property of parentView
and childView
to resize it. Then I was able to redraw the childView
in drawRect
successfully. Bottom line is though I think if you set a transform on a childs superview, I think you're stuck having to live with it in its subviews. I tried setting the transforms separately and all of the timing of the transforms got screwed up. The above situation from Brent might also come in handy for certain situations.