且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

防止子视图在其超级视图变形时发生变形

更新时间:2022-12-20 14:03:58

我不得不将旋转应用于 parentView ,然后设置 parentView childView 的bounds属性以调整其大小。然后,我能够成功地在 drawRect 中重新绘制 childView 。最重要的是,虽然我认为如果您对子级超级视图设置了转换,但我认为您不得不在子视图中使用它。我尝试单独设置转换,并且转换的所有时间都搞砸了。在某些情况下,来自布伦特的上述情况也可能派上用场。

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.