gpt4 book ai didi

iOS:-setFrame 在 CGAffineTransformMakeRotation 之后拉伸(stretch) View

转载 作者:行者123 更新时间:2023-11-29 10:40:18 26 4
gpt4 key购买 nike

我通过调用

旋转了一个 UIImageView

myView.transform = CGAffineTransformMakeRotation(someRadians)
myView.layer.allowsEdgeAntialiasing = YES;

如果我打电话...

[myView setFrame:CGRectMake(myView.frame.origin.x, myView.frame.origin.y-100, myView.frame.size.width, myView.frame.size.height)];

... 我的视野被拉伸(stretch)了,而不是简单地向上移动了一点。

这是正常行为吗?我不应该在旋转 View 后设置框架吗?有解决办法吗?谢谢。

最佳答案

来自UIView documentation :

Warning: If the transform property is not the identity transform, the value of this property is undefined and therefore should be ignored.

换句话说,如果 View 的 frame 没有身份转换,则不要使用它。

关于iOS:-setFrame 在 CGAffineTransformMakeRotation 之后拉伸(stretch) View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24848559/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com