我希望通过选择端点来调整上下文中的形状。并使用endPoints旋转它。任何人都可以建议我如何用正确的例子做到这一点?
我编辑的问题。
根据图像我必须通过其端点旋转和缩放形状
答案 0 :(得分:0)
当用户触摸端点时,您可以在touchesbegan中获取触摸的坐标:以及图像的帧和变换。当你移动时,你会在touchesmoved中获得一个新的触摸坐标:。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
self.touchStart = [[touches anyObject] locationInView:viewThatContainsImage];
self.imageStartFrame = image.frame;
self.imageTransformStart = image.transform;
[super touchesBegan:touches withEvent:event];
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
CGPoint newTouchPoint = [[touches anyObject] locationInView:viewThatContainsImage];
[super touchesMoved:touches withEvent:event];
}
使用起始帧,开始变换以及起点和当前点,可以计算出新的大小/角度变化。