我想知道TouchImageView中预定义的两点的最终坐标。1.只要移动触屏图像,这些代码就可以了。2.如果缩放或旋转触摸屏,ptLeft和ptRight是不正确的。
CGPoint ptLeft = CGPointMake (100, 100);
CGPoint ptRight = CGPointMake (200, 200);
TouchImageView *touchView = [[TouchImageView alloc] initWithFrame:rect];
....
....
/***** get the coordinate after TouchImageView has been scaled or rotated *****/
ptLeft = CGPointApplyAffineTransform(ptLeft, touchView.transform);
ptRight = CGPointApplyAffineTransform(ptRight, touchView.transform);以下是touchimageview源代码- TouchImageView源代码
发布于 2011-11-19 16:23:54
我使用UIView方法类似于:
ptLeft = [touchView convertPoint:ptLeft toView:[touchView superview]];
(后一个论点应该是你想要表达的观点。看起来您正在试图在superview中获得它,但是您可能想使用self.view或nil或其他什么。)
https://stackoverflow.com/questions/8193388
复制相似问题