Thursday, December 10, 2009

Stupid Objective-C Mistake #1

While laying out my screen, I keep objects handy in a couple of NSArrays. Typically, I start out coding all the layouting code and retouch it once I see what's rendered on screen. Many times, objects that I try to add to my layout just do not appear - because I failed to initialize my arrays!

Since in Objective-C, a message to a nil-variable just returns nil and moves on, you dont't have any indication that something might not go according to plan. Therefore this little note to self:

First thing to do if things do not appear on screen, check your arrays initializations, stupid!

No comments:

Post a Comment