围绕其左上角旋转矩形 [英] Rotate Rectangle Around Its Upper Left Corner
问题描述
.com / BHXdx.pngalt =
使用以下内容:
panGestureRecognizer.view.transform = CGAffineTransformRotate(panGestureRecognizer.view.transform,(M_PI * angle)/ 180);
但是这个矩形有一个大的循环。有什么翻译我需要做的,以使其发挥作用?
panGestureRecognizer.view.layer.anchorPoint = CGPointMake(0.0,0.0);
进一步阅读:对于更高级的内容,您可以尝试一些提示这里详细介绍矩阵转换: https://stackoverflow.com/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: https://developer.apple.com/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: https://stackoverflow.com/a/8536553/563381
这篇关于围绕其左上角旋转矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!