UIImage drawInRect when scaling beyond the bounds of the view
I am trying to use drawInRect to scale a UIImage during a pinch gesture.
However, the image is not scaling in the direction I expect. The intent is
to scale the image centered around the locationInView (start of the
gesture). In the drawRect for the view I call:
CGRect scaledRect = CGRectMake(x1, y1, x2, y2);
[saveImage drawInRect:scaledRect];
where (for example) X1 = -655.0, Y1 = -369.0, X2 = 1223.0, Y2 = 689.0, The
center point is {283, 160} and the view rect is {0,0,568,320}
What happens is that the image scales from the bottom right corner of the
iPad simulator, instead of from the center point.
I have confirmed that the upper left corner is 0,0.
Is there a property I am missing that sets the center point of the
drawInRect, or the drawInRect reference rect. I thought it would just draw
to the view rect and get cropped.
No comments:
Post a Comment