围绕其左上角旋转矩形

编程入门 行业动态 更新时间:2024-10-28 19:25:44
本文介绍了围绕其左上角旋转矩形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

/ BHXdx.pngalt =

使用以下内容:

panGestureRecognizer.view.transform = CGAffineTransformRotate(panGestureRecognizer.view.transform,(M_PI * angle)/ 180);

但是这个矩形有一个大的循环。有什么翻译我需要做的,以使其发挥作用?

解决方案

你只需要设置定位点: developer.apple/library/mac/#documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instp/CALayer/anchorPoint

panGestureRecognizer.view.layer.anchorPoint = CGPointMake(0.0,0.0);

进一步阅读:对于更高级的内容,您可以尝试一些提示这里详细介绍矩阵转换: stackoverflow/a/8536553/563381

Simply trying to rotate a rectangle around it's origin, or its upper left corner like so:

Am using the following:

panGestureRecognizer.view.transform = CGAffineTransformRotate(panGestureRecognizer.view.transform, (M_PI * angle) / 180);

But the rectangle is sort of rotating in a big loop. Is there some sort of translation I need to do to get this to work?

解决方案

You just need to set the anchor point: developer.apple/library/mac/#documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html#//apple_ref/occ/instp/CALayer/anchorPoint

panGestureRecognizer.view.layer.anchorPoint = CGPointMake(0.0, 0.0);

Further Reading: For more advanced stuff you could try some of the tips detailed here for matrix transformations: stackoverflow/a/8536553/563381

更多推荐

围绕其左上角旋转矩形

本文发布于:2023-07-18 04:56:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1141209.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:左上角   矩形

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!