CGAffineTransformMakeRotation不仅可以旋转,还可以移动和拉伸UIImageView
我正在尝试使用 CGAffineTransformMakeRotation() 函数将 UIImageView 旋转一定程度,但它最终以图像不仅旋转,而且移动到另一个坐标并拉伸 oO 我有不知道为什么会发生这种情况...这里有一段代码:
self.arrowToPoi.transform = CGAffineTransformMakeRotation( M_PI / 4 )
不知道这是否有帮助,但是 UIImageView
驻留在自定义 UITableCellView
中,它会自动更改其高度以适应 WebView
内容。
任何帮助将不胜感激!
I'm trying to rotate UIImageView
for certain degrees with CGAffineTransformMakeRotation()
function, but it end with image not only rotates, but also moved to another coordinates and stretched o.O I have no clue why do this happen... Here is a code:
self.arrowToPoi.transform = CGAffineTransformMakeRotation( M_PI / 4 )
Don't know if this can help, but UIImageView
resides inside custom UITableCellView
, which automatically changes its' height to accommodate WebView
content.
Any help will be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
contentMode
(属性当bounds
改变时图像如何调整,它们会做什么)。默认值为UIViewContentModeScaleToFill
,例如UIViewContentModeScaleAspectFill
存在奇怪的行为,听起来与您的问题类似。UIImageView
的中心旋转。contentMode
(property how the image is adjusted when thebounds
change, what they do). Default isUIViewContentModeScaleToFill
, with for exampleUIViewContentModeScaleAspectFill
there is strange behavior which sounds similar to your problem.UIImageView
's center.问题在于
UIImageView
的自动调整大小和自动位置功能以及加载WebView
内容后高度的变化。通过修复外部左箭头和外部顶部箭头来解决该问题。The problem was with auto-resize and auto-position feature of
UIImageView
and height changing afterWebView
content loaded. To solved the problem by fixing outer left and outer top arrows.我在 UITableViewCell 对象中有一个 UIImageView 需要旋转。我在旋转过程中也遇到了倾斜。通过将 UIImageView 的视图模式设置为
Center
解决了这个问题。I have a UIImageView in a UITableViewCell object that requires rotation. I also was experiencing a skew along with my rotation. It was solved by setting the view mode of my UIImageView to
Center
.检查您是否正在使用自动布局(iOS 6.x 中的新功能)。如果是这样,请将其禁用。
我遇到了完全相同的问题。禁用自动布局对我有用。您可以通过在 Xcode 中选择 Storyboard 文件,然后选择文件检查器并取消选中“使用自动布局”复选框来禁用它。
希望这对任何过来的人都有帮助......
Check if you are using Autolayout (new feature comming with iOS 6.x). If so, disable it.
I experienced exactly the same problem. Disabling Autolayout worked for me. You can disable it, by selecting the Storyboard file in Xcode and then selecting the File inspector and there unchecking the checkbox "Use Autolayout".
Hope this helps anybody that comes along...