How can I increase the size of a CGRect by a certain percent value? Should I use some form of CGRectInset to do it?
Example:
Assume I have a CGRect: {10, 10, 110, 110}
I want to increase its size (retaining the same center point) by 20% to:
{0, 0, 120, 120}
You can use
CGRectInsetif you like:To decrease the size, remove the
-s.Side note: A
CGRectthat is 20% bigger than{10, 10, 100, 100}is{0, 0, 120, 120}.Edit: If the intention is to increase by area, then this'll do it (even for rectangles that aren't square):