Take the 2-minute tour ×

I have CGRect with a default (square) size. The size is adjustable based on the view controllers needs, but always maintains a square proportion.

If I want to plot a point within the rect, but the scale of the rect is variable up and down in size, how would I calculate the new point position based on the change in rect size?

// in a UIView object, values always positive
- (CGPoint)convertPointToViewSizeScale:(CGPoint)point
    CGSize defaultSize = kViewSizeDefault;
    CGSize currentSize = self.frame.size;
    // ...
    return point;
share|improve this question
Can't you use the bounds.size.width and bounds.size.height to make adjustments for the new size. –  azamsharp Nov 14 '11 at 20:45

1 Answer 1

up vote 3 down vote accepted
point.x *= currentSize.width / defaultSize.width;
point.y *= currentSize.height / defaultSize.height;
share|improve this answer

Your Answer


