I'm trying to scale an UIView without scaling its subviews, or in my case I just want the subviews to be scaled in one axis. I need these hierarchy because I'm setting some Gesture Recognizers to detect panning and rotation and I want these to happen simultaneously with the parent view.
However, I don't want the scaling to happen simultaneously. For some subviews I want it to happen only vertically or horizontally or no scaling at all.
Is there a way to control the auto-scaling in an UIView's subviews when using CGAffineTransform on the UIView?
Set the view's
autoresizesSubviews
toNO
, by default it'sYES
.If you ensure the autoresizingMask's of subviews is correctly set up, you can change the frame of the container UIView (it is animatable) and the subviews will not change size (if your resizing mask is correct). Turning off containerView.autoresizesSubviews and changing the frame should also work.