Problem with window sizing


I just installed Lion and upgraded to Xcode 4.3.2. I created this first sample app as outlined in the book and it all seems to work fine. However, when the application runs, the window does not look exactly the same as it did in Interface Builder. The window is bigger and one of the buttons is larger than the other. If I do a Simulate Document from Interface Builder, it looks as I expect, but when I run the application it does not. I’m a little baffled as to why this is happening, I have never had this happen with previous versions of Xcode. Anyone else seen this or have any ideas what might be causing it?


You may be running into a combination of things: Lion’s user interface preservation, which remembers window sizes and restores them automatically, and Cocoa Autolayout, which is on by default in Xcode 4.3.x. Try making two changes and see if they help:

  1. Turn off Resizing for the window. Select the window in Interface Builder and, using the Attributes Inspector (4th tab), uncheck Resizing.

  2. Turn off Auto Layout. This is done for each XIB file individually. Select the File Inspector (first tab) and uncheck Use Auto Layout.

After making these changes, try running the application again; it should look like it does in Interface Builder.



Thanks! That seemed to work. I didn’t see Resizing, I see Resize at the top under Controls, is that what you meant? That one didn’t seem to make a difference, but turning off the Auto Layout seems to fix it.