Display Problem With iOS in Simulator and Device

Just found this[quote=368106:@Paul Lefebvre]2016r1 uses an older iOS SDK that does not support iPad Pro 12". If the iOS SDK does not support the iPad size, then iOS “scales” or “zooms” the older app up to the new size. When this happens, the app is considered to be “not optimized for the iPad”.[/quote]

Just found this thread: https://forums.developer.apple.com/thread/28037

Xojo 2016r2 introduced launch storyboard, prior to that version of Xojo, iPad pro will only scale up the display.

End of story, there is no bug in Xojo 2017r3 :slight_smile:

Thank you Jrmie.

Now I understand there is no bug in Xojo 2017r3, but for the information on the thread you linked, it looks like the OP was able to accomplish just what James want. Remove the native support for iPad Pro 12.9 so the app will support the normal iPad resolution and “scale/zoom” in iPad Pro 12.9

Do you know if it’s possible to tell Xojo to “not support” iPad Pro 12.9 resolution so the final app will scale? I don’t understand all from the thread you linked.

[quote=368113:@JrmieLeroy]Using auto layout with % of parent width/height values can achieve this.

You can then cycle through all labels and buttons on the view to increase their font size.[/quote]

Thanks Jeremie, I just don’t know how you do this. I never saw anything that talks about scaling controls in the documentation, nor an example app that shows this. I don’t mind doing the work if I know what I’m doing. I need to be able to layout the view and have it scale the controls and fonts to the correct resolution. I just don’t get the % of parent width and height.

Something like this:

Which means that the width of the button is equal to 20% of the total width of its parent, minus 12 points.
When a button is placed in a View, it will take 20% of the width of the view minus 12 points.

EDIT
And if you loop through all buttons to adjust the font, I would recommend adding this function to a module and calling it on each button after changing the font.
It will make sure that the button text label always fits inside the button boundaries.

[code]Public Sub AdjustsFontSizeToFitWidth(extends bt As iOSButton)

Dim label As ptr

Declare Function getTextLabel Lib “UIKit” selector “titleLabel” (obj_ref As ptr) As ptr
label = getTextLabel(bt.Handle)

Declare Sub setAdjustsFontSizeToFitWidth Lib UIKitLib selector “setAdjustsFontSizeToFitWidth:” (id As ptr, value As Boolean)
setAdjustsFontSizeToFitWidth label, True

End Sub
[/code]

Call it like this:

button.AdjustfontSizetoFitWidth

Thank you Jeremie, but I still don’t understand how to create a UI so that it is proportional to all screen sizes. None of the examples that Xojo provides show how to do this.

I don’t see how you use the IDE to create a view that will be proportional for the 12.9 iPad, and also for the iPad Mini.

I have attached a simple example app that is for the iPad only and will only display in Landscape, so I don’t even have to worry about formatting the UI in Portrait.

link text

How do you set the autolayout for the controls so that it will be proportional for all iPad devices?

The IDE shows everything in proportion, but when you run it in the simulator, it is not formatted correctly.

[quote=368120:@JrmieLeroy]Something like this:

[/quote]

Using the scale factor of Auto-layout will make controls proportional to the width of the iOSView.

By the way I also notice on the picture you shared of both iPads, that the buttons at the bottom of the screen aren’t correctly aligned. The baseline of the last button to the right is lower than the others, and possibly the first one on the left too.

Your example shows how to keep the width of the button proportional to the screen, but you also have to have the buttons proportional to the Left, Right, Top, and Bottom. You can use the offset to move things around, but it moves in pixels, not percentages. The pixel count will be different for each size iPad. So moving a button 150 pixels in one direction on a 12.9 inch iPad will look different from moving the same number of pixels on an iPad Mini. Right?

You can’t tell the control that I want it to be offset to the right edge of the screen by 10%. If you could do that, you could place the controls on the screens and arrange their offsets by percentages and not pixels.

Or if I want the control to be right in the middle of the screen it could be placed, so the center of the control is 50% of the total parent. I don’t see how you put a control right in the middle of the screen so that it will be proportional to all screen sizes.

You are right about the example picture. The button on the bottom right is slightly lower. Thanks for the heads-up.

Horizontal Center auto-layout constraint is the way to go.

[quote=368114:@JrmieLeroy]Xojo 2016r2 introduced launch storyboard, prior to that version of Xojo, iPad pro will only scale up the display.

End of story, there is no bug in Xojo 2017r3 :)[/quote]

Well, (https://xojo.com/issue/49461)>]except that launch screens don’t work properly… :slight_smile: