I started a new project in the new Xcode, and I see that my default the main window is set to 320×548. I’m fine with that, but when I test my app, a view I added to my main xib, which is supposed to be 280×280, looks more like 280×200 when testing on 3.5in devices.
I’ve tried changing the settings for that view in the xib, but nothing seems to affect it.
How do I ensure background compatibility so that in older devices the view is the same size?
Update:
When I add the the view programmatically, it all works fine, but when I add it via an outlet in my controller, it all gets squashed. I tried to force (programmatically) the view to be 280×280, but then it just distorts the content of the view. It just wants to be 280×192…
I must be doing something wrong, but I don’t know what.
I had the same issue nowadays, and fortunately found the solution. I created a simple application which contains a simple button, I wanted to set it’s size with a 10px margin around.
The self.view.bounds returns with the actual size of the xib, if it set to for example iPhone4 retina and you test it in a different iPhone version, it will return incorrect value. Use [[UIScreen mainScreen] bounds]; instead, and substract the height of the statusbar ( [[UIApplication sharedApplication] statusBarFrame].size.height ).
The final stuff looks like this:
I tested it on all of the device types, and it worked fine.
(Obviously it only works when the “Use Autolayout” is unticked)
Hope this helps.