320 points width of iPhone 6 plus screen


#1

Hi there. Maybe a beginners question, but why does getWidth() return 320 when running full screen on an iPhone 6 plus? I would assume a higher number for this screen since the width is 414 points. Thanks.


#2

Hi JohnParbo,

JUCE works with logical pixels (just like macOS on a retina display). Logical pixels can represent several physical pixels (for example on retina it’s two physical for one logical). You can get the conversion factor between logical and physical pixels, called scale factor, in JUCE’s Display structure.

Fabian


#3

Yes, he clearly says “points” not pixels.
Shouldn’t have Phone 6s plus 414 logical pixel/aka points?

https://www.paintcodeapp.com/news/iphone-6-screens-demystified


#4

Hmmm, not sure if they are the same in juce. We use this method to determine the scale factor.


#5

This would be unusual, generally on bigger screens, there is more space which should be used, if resolution stays at 320 for iphone 5, 6, 6plus UI programming is rather complicated than on the desktop.
JUCE should use the points as logical pixels. If not same button size has a different physical size on every device.


#6

Thank you for the answers. I would still expect to have more points to work with on a screen with higher resolution. It seems that we dont get more pixels/points to work with on the “plus” devices. Best regards John


#7

We do. This number 320 comes from the OS, not from JUCE.

Maybe the OS has decided that this app should be run in a backwards-compatibility mode - because many old iOS 3 apps expected a fixed screen resolution, I think it sometimes runs apps in a way that hides the real display resolution from them. Not sure how that’s determined, maybe a plist setting (?)

You seem to be getting pixels and points confused. Higher resolution = more pixels, but not (necessarily) more points.


#8

Hi Jules. Ok thanks, I am aware of the pixel/points difference, but maybe thats not that clear in my question(s). I would expect getWidth() to return a higher value than 320 on the iPhone 6 plus (the scale factor is 1). I will look into your suggestions and see if I can find out what is going on. Thanks


#9

@jules

To let the system know that your app supports the iPhone 6 screen sizes, include a storyboard launch screen file in your app’s bundle. At runtime, the system looks for a storyboard launch screen file. If such an file is present, the system assumes that your app supports the iPhone 6 and 6 Plus explicitly and runs it in fullscreen mode. If such an image is not present, the system reports a smaller screen size (either 320 by 480 points or 320 by 568 points) so that your app’s screen-based calculations continue to be correct. The contents are then scaled to fit the larger screen.

https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html
(shouldn’t that be the default for all new apps?


#10

IIRC you have to supply launch images at the larger screen sizes to indicate you support higher resolution screens. Then the scale should report 2 (or 3 on the 6+ I believe) with the width similar to before.
(This may have changed though as it’s been a couple of years since I last did any iPhone dev).


#11

Thanks a lot for all the answers. I will try to add a launch image as suggested and see if this fixes the issue. If this is the case it would be nice if this was somehow managed from the ProJucer.


#12

Adding launch images as suggested above did fix the issue. Thanks a lot.