Klaus wrote: ↑Fri Oct 28, 2022 6:30 pm
I finally found a way to resize my stack when already as a runtime ON THE DEVICE!
Oh dear - well, learning while coding means constantly reinventing the wheel, an that's a curse and a blessing for us all, but perhaps I should be sorry I didn't chime in on this thread earlier...
I've been using a method for an app I have in App Store where I design the app for a 4:3 aspect ratio, which was the common one for all iPads until iPad Air 4th gen (2020). Then:
Code: Select all
on preOpenStack
if the environment is "mobile" then
if machine() begins with "iPad" then ## Scale up instead of rearranging
set the fullscreenmode of this stack to "letterbox"
else
set the rect of this stack to the screenRect
end if
end if
end preOpenStack
Since I didn't want/need the app layout to take advantage of the iPad's larger screen area, it was convenient to just scale it up if the device is an iPad, and change the stack rect and rearrange the layout only if it is an iPhone (by cascading resizeControl handler triggers in groups).
From iPad Air 4th gen on, there are several iPad aspect ratios (4:3, 23:16, 10:7, 6.1:4), so this strategy is unfortunately obsolete, and I need to rework it.
In any case, before the iPhoneSafeAreaInsets() function was introduced, I made and shared an LC library that takes the iphoneDeviceModel() function (LC9.6.3) and looks up the safe area margins AND the device name/model (if needed) from a source that I've created.
Although this too is perhaps half obsolete, now that iPhoneSafeAreaInsets() exists, it may still be a useful example of responsive design. I updated it today (29 Oct 2022) with the latest Apple devices.
You can freely access the library and demo stack here:
https://github.com/wheninspace/WISmobDeviceLib
The best resource that I've found on the net for getting useful insights about Apple device parameters is this one:
https://www.screensizes.app/ (click Charts and then Compare models to get full lists)
And this one has a more comprehensive list of screen sizes, if that is of interest:
https://www.ios-resolution.com/
These kind of lists are already very long for Apple devices - I suppose there exists similar projects for mapping Android devices, but such lists are likely to be 10 or 100 times as long, so developing for mobile is always going to be a nightmare...
