Two iPhone SDK facts you may not know

I discovered (quite by accident) two things today about iPhone software development. These are things that are probably documented and discussed elsewhere, so here is yet another documenting/mentioning of them.

1. The order of stuff in Interface Builder is actually pretty important

So I am in Interface Builder, copying and pasting some repetitive stuff. I usually like to have the document window open on the left of the screen, the view open middle left, the inspector middle right, and the library on the right. And every once in a while, the stuff I pasted that showed up at the bottom of the list of controls in my view disappeared.

As it turns out, this was happening when I was subconsciously sending the newly pasted controls to the back, and as you may not know, the order of the controls as shown in a view pertains exactly to the z-order of the controls. The control that I was sending to the back going to the top of the list of controls under the view in the document window.

2. Don’t try to present a modal view controller on top of another modal view controller

The subject above says it all. If you create a view controller and use the presentModalViewController method, nothing really happens. The new view is created, but just sort of fizzles out before reaching the screen. (Or in other words, the init is called, but viewDidLoad is never reached.)

This will present a bit of a challenge, as just about every other environment I have worked in allows you to lay modals on top of other modals.

Leave a Reply