any iOS devs here? Looking for some help on scale/size issue in iOS 8 vs iOS 9

purbeast0

No Lifer
Sep 13, 2001
52,858
5,729
126
I've recently updated Xcode to 7 so I could start developing against iOS 9. Upon first launching my application, I noticed that the screen size/scale is off compared to how it looks on iOS 8, both on the iPhone 6 device.

Here is how it looks correct on iOS 8:

http://i.imgur.com/CP6PWTA.png

Here is how it looks incorrect on iOS 9:

http://i.imgur.com/zDj1MQb.png

If you also notice, both of those images are the same exact size.

Note how the AdMob banner has white space on the left/right, I'm assuming AdMob just knows to center it. Also the big white space to the right of the table view and the button down on the bottom.

Also, when in iOS 8, and putting a break point in the main delegate method, the main window has a frame of (0 0; 320 568). The layer on the window is also the same.

On the flip side, when in iOS 9, and putting a break point in the main delegate method, the main window has a frame of (0 0; 375 667). The layer on the window is also the same.

That explains why the difference in the look of the app in iOS 8 vs. iOS 9, but I do not know why iOS 8 looks the way I want it to and iOS 9 doesn't. Is there some setting that I'm missing?
 

uclabachelor

Senior member
Nov 9, 2009
448
0
71
Are you using the auto layout for that view controller?

Have you tried resizing the view in code so it stretches and fill the frame at runtime?

Are you using a XIB file for that view controller? What's the view mode set on that view element?
 

purbeast0

No Lifer
Sep 13, 2001
52,858
5,729
126
Are you using the auto layout for that view controller?

Have you tried resizing the view in code so it stretches and fill the frame at runtime?

Are you using a XIB file for that view controller? What's the view mode set on that view element?

i'll try to take a stab at this without having the code in front me since i'm at work, but no i am not using auto-layout i don't think. if you are talking about that checkbox on the first tab in the xib file, then no, i'm not using it. i remember seeing that.

as far as resizing at run time, i did try this, by changing the window frame, and it didn't work as expected. i believe it's because while the window changed, the subviews didn't change. this is a possibility to maybe change the main view and all of it's subviews, but i didn't want to go down that path yet because i want to know what the root cause of this is between the two ios versions.

i'm not sure what the view mode is for the view element. i'd guess it is just whatever is default but i can't be sure right now.
 

purbeast0

No Lifer
Sep 13, 2001
52,858
5,729
126
so a little bit more information...

I've since figured out that the bounds of the mainScreen is different between when this runs in iOS 8 vs. iOS 9. The screenBounds of the mainScreen is set to the same frame as up above, and I have no clue why it is different between the two iOS versions.

HOWEVER ... I just created a brand new project and tested this out. I do not get the same behavior as explained up above. When I view the mainScreen bounds, in both iOS 8 and iOS 9, it is (0,0;375,667).

But I want it to be how it currently is, where it kind of simulates the iphone 5 resolution somehow. Everything just works that way.
 

purbeast0

No Lifer
Sep 13, 2001
52,858
5,729
126
After toying around quite a bit last night, it turns out that the launch images are causing this to happen. If I remove the launch images of Default-568@2x.png from the list, then it displays properly. Very odd that something like this can effect the scale. I still didn't figure out how to solve this yet though because you have to have launch images or apple will reject the app, so tonight i hope to solve how to make it work with launch images for ios 9.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,250
3,845
75
I have no iOS experience, but I just searched, and found something different with 8 and 9's launch images:

In iOS 8 and later, you can create a XIB or storyboard file instead of a static launch image. When you create a launch file in Interface Builder, you use size classes to define different layouts for different display environments and you use Auto Layout to make minor adjustments. Using size classes and Auto Layout means that you can create a single launch file that looks good on all devices and display environments. (For an overview of display environments and size classes, see Build In Adaptivity; to learn how to use size classes in Interface Builder, see Size Classes Design Help.)
 

purbeast0

No Lifer
Sep 13, 2001
52,858
5,729
126
I have no iOS experience, but I just searched, and found something different with 8 and 9's launch images:

well that is saying that is for iOS 8 and later, which would mean that it works the same for iOS 8 and 9 (unless i'm missing something else).

i did find out though as to what is different between different versions.

iOS 7 - you have to use specific named .png files for launch images (Default.png, Default@2x.png, etc)

iOS 8 - you can use that, or you can use the assets and the LaunchImage.xib inside of the asset

iOS 9 - you MUST use the assets and it no longer supports the iOS 7 way.

my current app is using the iOS 7 way for launch images, so that can explain why that launch image works for iOS 8 i guess.

however, i still don't understand why REMOVING all of them (all of the Default* files) from my project makes it just work on iOS 8 and iOS 9.

i was not aware sizes classes and stuff though in the .xib launch image file, and that is what i planned on messing around with tonight. i figured this out last night right before i went to sleep.

the thing is too, i had tried deleting the launch images from the project 2 days ago, and it didn't work, but for some reason, the launch image stuff doesn't get updated unless you completely wipe the app off your device and redeploy it, which i hadn't done until last night. basically i wasted 2 days lol.