gpt4 book ai didi

uiview - 转换后如何获取UIView框架位置?

转载 作者:行者123 更新时间:2023-12-04 04:23:29 24 4
gpt4 key购买 nike

我想在将变换旋转应用于UIView之后获取UIView的当前位置。我怎样才能做到这一点 ?

在UIView文档中,我发现了有关transform属性的内容:

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



我尝试改用center和bounds,但是结果得到了转换(即使没有将任何变换应用于rotatedView时)
newView.center = rotatedView.center;
newView.bounds = rotatedView.bounds;
newView.transform = rotatedView.transform;

有人可以帮忙吗?

在此先感谢文森特。

最佳答案

如果知道转换前的帧,则可以使用CGRectApplyAffineTransform函数来计算转换后的值。

关于uiview - 转换后如何获取UIView框架位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1729324/

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