Search code examples
iphoneviewsizeios6iphone-5

view size on iphone 5 screen incorrect


I am using in my app the view size to position a subview in code.

for example like this:

self.view.bounds.size.height

This subview has to be animated in and out of the view.

This has worked perfect on older devices, now I am trying to support iphone 5 and found out that I still get the height of the old devices. Everything except this animated view adapts perfect for iphone 5.

The only way to get the right size is if I change the size of the view in the xib, downside is that if I now run my app on iPhone 4 the view size is the 4inch view size.

What is the problem here? Or is this the way it is supposed to be and I have to create an extra xib file for iPhone 5?


Solution

  • Alright so the answer is the following:

    Like @mrwalker said make sure that the view automatically or programmatically resizes.

    And be aware of the fact that the view is not yet resized in the viedDidLoad method. (This was my mistake)

    If you need the resized views size do your stuff in viewWillAppear there the view has already the right size.

    thanks to @mrwalker and @AndyDev