Monthly Archives: May 2010

Event tracking stops NSTimer

NSTimers usually don’t fire when the user is scrolling a table or other UIScrollView – or doing anything else that puts the run loop in event tracking mode.  This post describes the problem and an easy solution. The problem Suppose you set up a timer in the most convenient manner, with something like this: [NSTimer […]

Memory management guidelines

In this post, I’ll outline four simple rules for memory management in Objective-C. The Apple docs have already established basic guidelines for object ownership, following the fundamental idea that if you own an object, then you’re responsible for releasing it. This post goes a step further with tips for when and where ownership can be […]

Preprocessor debugging goodies

Ok, I admit it – my favorite debugging tool is still NSLog (and print statements in general).  In this post I’ll mention some useful debug logging techniques you can use with the help of preprocessor macros. Logging method calls It’s as simple as this: #define PrintName NSLog(@”%s”, __FUNCTION__) Add this macro (with a semicolon) to […]

Fun with layers