Categories
Development Objective-C Work Note

Work Note: That compiled?

I just ran across something that had me stumped for a while, I just couldn’t see it, and I would have thought the compiler would have choked on it. It didn’t, it built, and ran, and produced interesting results.

Confession time: I’m not using auto layout, yet. Why? I haven’t had the time to commit to it. Yes, I’m aware it would probably save me time in the long run. I will learn it, of course, just not today.

Anywho, back to the story.

I hade some code that looked like this, I must have been distracted mid-thought, and did a build. This code built.

self.thingView.frame = frame;
self.thingView.frame

AHHHHHH!Anyone see a problem there? No assignment, no closing “;”. The code built and ran! The outcome was my view moving into strange positions during rotation for no apparent reason. Wow.

I finally had to do a diff to find it, I just couldn’t see it.

By Rob Fahrni

Husband / Father / Developer