What happens to the view.frame.size attribute after a CGAffineTransform (Rotate)?(在 CGAffineTransform (Rotate) 之后 view.frame.size 属性会发生什么?)
问题描述
我有一个 UIImageView,可以通过捏合来调整大小(例如:view.frame.size.width+10).Image View 的图像也可以旋转(CGAffineTransformMakeRotate).好的,问题来了:当我在应用 Rotate Transform 之后调整 UIImageView 的大小时,视图会异常调整大小(相反(当它应该增长时缩小,反之亦然)或以巨大的调整大小单位增量).无论是否应用 CGAffineTransform,如何以一致的方式调整 UIImageView 的大小?
I have a UIImageView that can be resized by pinching in and out (Example: view.frame.size.width+10). The image of the Image View can also be rotated (CGAffineTransformMakeRotate). Okay, here is the problem: When I resize the UIImageView AFTER having had applied a Rotate Transform the view resizes abnormally (inversly (shrink when it should grow, vice-versa) or at enormous resize unit increments). How can I resize my UIImageView in a consistent manner whether or not a CGAffineTransform is applied?
推荐答案
UIView 表示,对于 frame 属性:
There's a warning in the documentation for UIView that says, for the frame property:
警告:如果 `transform` 属性不是恒等变换,则该属性的值是未定义的,因此应该被忽略.
Warning: If the `transform` property is not the identity transform, the value of this property is undefined and therefore should be ignored.
改用 bounds 和 center 属性;它们在应用转换后仍然可行.
Use the bounds and center properties instead; they remain viable after a transform is applied.
这篇关于在 CGAffineTransform (Rotate) 之后 view.frame.size 属性会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 CGAffineTransform (Rotate) 之后 view.frame.size 属性会发生什么?
基础教程推荐
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- iOS4 创建后台定时器 2022-01-01
