CGRect screenSize = [[UIScreen mainScreen]bounds];
CGFloat screenWidth = screenSize.size.width;
CGRect visibleRect;
visibleRect.origin = scrollView.contentOffset;
visibleRect.size = imageView.frame.size;
CGPoint midPoint = CGPointMake(visibleRect.origin.x + visibleRect.size.width / 2, visibleRect.origin.y + visibleRect.size.height / 2);
CGPoint place = CGPointMake(class.xValue, class.yValue);
xValue 和 yValue 在类中声明为“int”。
-(int)distanceFrom:(CGPoint)point1 to:(CGPoint)point2{
CGFloat xDist = ((point2.x) - (point1.x));
CGFloat yDist = ((point2.y) - (point1.y));
return (sqrt((xDist * xDist) + (yDist * yDist)));
}
问题是,一旦我通过在应用程序中滚动来更改 zoomScale 并调用该方法,数字就会急剧变化(约 1000 像素)。如何考虑缩放比例?提前致谢, 亚历克斯