【发布时间】:2013-05-28 03:40:09
【问题描述】:
我正在使用SPUserResizableView 来调整我的视图大小。我为它添加了旋转功能。当我触摸角手柄视图应该为此目的旋转时,我添加了一些代码,但它不能正常工作。这是我的代码:
CGPoint center = CGPointMake(CGRectGetMidX([view bounds]), CGRectGetMidY([view bounds]));
CGPoint currentTouchPoint = [touch locationInView:view];
CGPoint previousTouchPoint = [touch previousLocationInView:view];
CGFloat angleInRadians = atan2f(currentTouchPoint.y - center.y, currentTouchPoint.x - center.x) - atan2f(previousTouchPoint.y - center.y, previousTouchPoint.x - center.x);
[self setTransform:CGAffineTransformRotate([view transform], angleInRadians)];
注意:当用户触摸角手柄时,会调用我编写这段代码的方法。如果用户触摸边缘手柄,则不会调用该方法。
谢谢。
【问题讨论】: