A retweet wasn’t enough this time. If you work with APIs you’ll relate to this (baby is optional)
Tag: code
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
[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
What I probably miss the most in Objective-C
@implementation NSString (numericValue) - (NSNumber *)numericValue { return [NSNumber numberWithInt:[self intValue]]; } @end