Skip to content
Koke

Koke's Journal

Mobile Engineer @ Automattic, making WooCommerce for iOS

Tag: objc

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

[sourcecode lang=objc] – (void)cancelVie…

- (void)cancelView:(id)sender {
    [self cancelView:sender];
}

Probably the most stupid looking code I’ve written in a long time.

In my defense, I’m in the early stages of merging two huge classes, so stuff like this was expected. Still looks stupid

Jorge Bernal Photos Leave a comment January 22, 2011 1 Minute
Proudly powered by WordPress | Theme: Independent Publisher 2 by Raam Dev.