iphone UIImage 按端点调整大小

发布于 2024-12-08 19:17:34 字数 178 浏览 2 评论 0原文

我想通过选择端点来调整根据上下文绘制的形状的大小。并用其端点旋转它。有人可以建议我如何用适当的例子来做到这一点吗?

我编辑的问题。

在此处输入图像描述

根据图像,我必须通过其端点旋转和缩放形状

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?

My edited Question.

enter image description here

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里寻她 2024-12-15 19:17:34

当用户触摸Endpoint时,可以在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];
}

通过起始帧、起始变换以及起始点和当前点,您可以计算出新的尺寸/角度变化。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文