What is the best way to normalise CGRect
values so that they are between 0 and 1 (unit coordinate system)?
A very concise way of doing this would be:
CGAffineTransform t = CGAffineTransformMakeScale(1.0 / parentRect.size.width, 1.0 / parentRect.size.height);
CGRect unitRect = CGRectApplyAffineTransform(rect, t);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With