开发者

iphone UIImage resize by endpoints

开发者 https://www.devze.com 2023-04-11 23:37 出处:网络
I want resize the shapes draw on context by picking their endpoints. And also rotate it with its endPoints. Can anybody suggest me how can I do this with proper example?

I want resize the shapes draw on context by picking their endpoints. And also rotate it with its endPoints. Can anybody suggest me how can I do this with proper example?

开发者_StackOverflow社区

My edited Question.

iphone UIImage resize by endpoints

According to the image I have to rotate and scale the shapes by its Endpoint


when the user touches the Endpoint, you can get the coordinates of the touch in touchesbegan: and the frame and transformation of the image. When you move, you get a new coordinate for the touch in 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];
}

With the starting frame, starting transformation and the starting point and current point, you can figure out the new size/angle change.

0

精彩评论

暂无评论...
验证码 换一张
取 消