Wednesday, October 07, 2009

Objective C Hello World, Part III

Completed the tutorial, and the app seems to work as expected. I only ran into one inexplicable quirk: when the app runs, the MyViewController view ends up rendering in the simulator at the upper bound of the screen, beneath the phone's status bar. Here's how the view window looks in Interface Builder:


Here's how it looks in the iPhone simulator:


The green band at the bottom is the background of the main view showing through.

The problem appears related to displaying the simulated status bar in IB. When Status Bar (in the View Attributes palette under "Simulated Interface Elements") is set to "Gray", the height (H on the View Size palette) is set to 460, and it's display-only. Changing Status Bar to "None" makes the height property field editable; changing it to 480 makes the view the full height of the screen. This gets rid of the green band, but leaves the edit field right up against the simulator's status bar. The only solution I can find here is to scoot the field down.

This sure seems like a bug with the simulator. Shouldn't the top edge of the view render just below the status bar? I'm betting this is how the app would behave on an actual device.

No comments: