Scale UIView without scaling subviews

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?


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.


将视图的autoresizesSubviews设置为NO ,默认为YES

链接地址: http://www.djcxy.com/p/53618.html

上一篇: 嵌套循环中匿名闭包的可读性

下一篇: 在不缩放子视图的情况下缩放UIView