3
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 and yValue being 'int's declared in the class.

-(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)));
}

The problem is that once I change the zoomScale by scrolling in the app and recall the method the numbers change drastically (~1000 pixels). How to I take into account for the zoomScale? Thanks in advance, Alex

avs
  • 65
  • 8

1 Answers1

0

when you are zooming in, the result from distance method is multiplied by zoomScale of the scroll view. If you want get actual distance, try dividing the distance by zoomScale of the scroll view.

Avigit
  • 284
  • 2
  • 3
  • 13
  • did it work? It it worked, please accept the answer by clicking on the tick mark on the left. thanks – Avigit Jan 31 '13 at 15:30