Skip to content
Koke

Koke's Journal

Mobile Engineer @ Automattic, making WooCommerce for iOS

Tag: quartz core

Dealing with CGRects

If you’ve ever written code like this:

  CGSize size = self.bounds.size;
  CGRect r = CGRectMake(MARGIN, MARGIN, size.width - 2*MARGIN, size.height - 2*MARGIN);

Do this instead:

  CGRect r = CGRectInset(self.bounds, MARGIN, MARGIN);

And while you’re at it, go read about CGGeometry

Jorge Bernal Programming Leave a comment February 4, 2013 1 Minute
Proudly powered by WordPress | Theme: Independent Publisher 2 by Raam Dev.