Suddenly resizing for a different size device

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Suddenly resizing for a different size device

Post by marksmithhfx » Sat Oct 24, 2020 8:19 pm

Here is a conundrum (at least for me).

I had to drop off my usual development device (a 2018 macBook Pro, retina 13 inch) for a new battery and will be without it for (up to) a week. So I fired up an early version I've used off and on, a 2015 macBookPro, retina 13 inch). It synced my desktop through iCloud which syncs a lot of my documents but not apps. So this laptop has LC 9.0.4 (the other 9.6.1) and Xcode 10.1 (vs 11.5). Everything I've been working on is scaled to fit on an iPhone 6s. So on this backup machine I was able to pickup where I left off and compile but with older software (only "minimal layout" wasn't supported in the earlier LC version). BUT, when I installed it on my iPhone 6s the right hand side of the screen is missing (about 1/2 inch, as well as the bottom of the screen, about the same amount) and all of the text, images, layout etc is beautifully scaled for a much bigger device?

What determines (and where) how a LC app gets scaled to a particular iPhone model? Anyone have any guesses as to what might be going on?

Thanks
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Suddenly resizing for a different size device

Post by marksmithhfx » Sat Oct 24, 2020 8:39 pm

So just to add to this tale, I selected a project I previously compiled on the other (newer) laptop and installed it from this older backup laptop. It scaled perfectly on my iPhone. So this suggests to me that the reason it is appearing larger has something to do with compiling this on the older macBook. My brain tells me things look bigger on this screen than on my other one, but of course I don't have the 2 laptops to compare side by side right now to see if there are differences. But I never heard that a scaling on a laptop could effect how it looks on a mobile device. Does that make sense to anyone? And btw, everything looks fine in the IDE. There is no indication that things are going to be bigger on the iPhone 6s.

Mark
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5680
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Suddenly resizing for a different size device

Post by jacque » Sun Oct 25, 2020 4:49 pm

Mobile devices require some kind of scripted scaling to account for the various screen sizes on different devices. You can either script the dimensions and locations of every control in a resizestack handler or use fullscreenmode to do it automatically.

The source machine doesn't matter. I'd look at the stack that behaves correctly to see if there's any scaling instructions in the scripts.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Suddenly resizing for a different size device

Post by marksmithhfx » Mon Oct 26, 2020 3:59 pm

jacque wrote:
Sun Oct 25, 2020 4:49 pm
Mobile devices require some kind of scripted scaling to account for the various screen sizes on different devices. You can either script the dimensions and locations of every control in a resizestack handler or use fullscreenmode to do it automatically.
Thanks Jacque, as usual a great answer. I took the time to investigate further (there is a lesson on fullscreenmode, as well as another on how to manually resize assets). Since I've now tried all the fullscreenmode modes, it is clear my stack was just using the default (you don't have to specify it) "empty" option. Not scaled. The question is why it needed scaling at all. The script is identical to last weeks (just copied over), and its being compiled by LC and uploaded by Xcode. The only actual changes are the specific laptop (they are both MacBook pro's, just different generations but both 13" retinas), LC (9.0.4 vs 9.6.1), and Xcode (10.1 vs 11.5). That's it. I vaguely remember scaling this laptop because of failing eyesight many years ago, but eventually got glasses and didn't bother doing that on the new one. At this point I no longer remember if that was just wishful thinking on my part or I was actually able to do something that I've now forgotten (but I'll check to see if I can see a difference when the other laptop comes back from the shop). But in any event, copies of my iPhone 6s app are compiling about 20% bigger on this laptop and I don't know why.

With respect to fullscreenmode. ExactFit, Letterbox and NoBorder all result in perfect fits on my 6s as they should. In fact, because this was designed on a 6s stack and is now being uploaded to a 6s they should all result in the exact same outcome (ExactFit is scale to fill, ignore aspect; Letterbox is scale to fit, preserve aspect and finally NoBorder is scale to fill, preserve aspect). Since it was designed for a 4.7" and is being uploaded to a 4.7" whether you preserve or ignore aspect should not be an issue. And it looks like that is true. So I'm out of trouble for the moment :)

Going back a step, since this app is intended for commercial distribution I knew I was facing a rescaling challenge somewhere down the road. This hasn't resolved all the issues I'll be facing, but certainly has thrown me into the deep end head-first so to speak. At present it does not look too bad. It looks like there might be a few assets I will need to fiddle with to make them proportionately scale relative to the screen size, but I think it will be far less trouble that I was expecting. Fullscreenmode looks like a real blessing for the LC community.

Mark
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8172
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Suddenly resizing for a different size device

Post by FourthWorld » Mon Oct 26, 2020 4:48 pm

marksmithhfx wrote:
Mon Oct 26, 2020 3:59 pm
...there is a lesson on fullscreenmode, as well as another on how to manually resize assets.
I've been looking for a good LiveCode lesson on object placement for mobile, but I missed those. Where can I find them?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5680
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Suddenly resizing for a different size device

Post by jacque » Mon Oct 26, 2020 9:26 pm

If you're planning for distribution, it's a good idea to use the simulator to target different devices and sizes. There's quite a bit of variance. I can't explain why one Mac would compile to a different size than the other, the calculations are based on pixel dimensions. There is some adjustment for screen resolution but that applies to the target device, not the source device; at least, that was my uderstanding. Maybe that's wrong.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Suddenly resizing for a different size device

Post by marksmithhfx » Tue Oct 27, 2020 2:08 am

FourthWorld wrote:
Mon Oct 26, 2020 4:48 pm
marksmithhfx wrote:
Mon Oct 26, 2020 3:59 pm
I've been looking for a good LiveCode lesson on object placement for mobile, but I missed those. Where can I find them?
The one on fullscreenmode is http://lessons.livecode.com/m/15262/l/5 ... ll-devices and the one on resizing assets is http://lessons.livecode.com/m/4071/l/11 ... g-graphics.

Mark
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8172
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Suddenly resizing for a different size device

Post by FourthWorld » Tue Oct 27, 2020 3:27 am

Thank you, Mark. I hadn't come across the explicit placement lesson before. And they use resizeControl with groups for cascading logic - good to see.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

bwmilby
Posts: 351
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Suddenly resizing for a different size device

Post by bwmilby » Wed Oct 28, 2020 12:57 am

Do you have all of the launch/splash screen images populated? In 9.0 that was necessary. Your LC app would not see the actual rect of the device unless a corresponding image was provided. The latest versions use a different method for the splash.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Suddenly resizing for a different size device

Post by marksmithhfx » Thu Oct 29, 2020 12:16 pm

bwmilby wrote:
Wed Oct 28, 2020 12:57 am
Do you have all of the launch/splash screen images populated? In 9.0 that was necessary. Your LC app would not see the actual rect of the device unless a corresponding image was provided. The latest versions use a different method for the splash.
HI Brian, the app does not have a splash screen, and in fact when you see it you will see why. It's like a personal organizer (think the Calendar app). You really want that to open straight into the app so the splash/launch screen is superfluous. I'm not sure what you meant by "the LC app would not see the actual rect of the device unless a corresponding image was provided" Could you explain a bit more? So far, when testing this it has worked perfectly with just the "home" screen of the app (which consists of a Header Bar, Nav Bar and datagrid). The problem arose when I compiled on an older macBook Pro (2 years older) that has the same screen specs (13" Retina). The compiled program came out about 20% larger cutting off the right hand side and bottom of the app on the iPhone (as is consistent, I've now discovered, with "set fullcreenmode to empty"). I've now compared the two mac's side by side and can confirm everything is about 10%-20% larger on the old one (I must have messed with a setting somewhere and got it to "blow up" everything to compensate for failing eyesight. Glasses are such a neat invention :)

Anyway, I've run into another, sort of related problem, perhaps you could throw some light on. When I initially encountered the problem above, the solution to keep working was to set the fullscreen mode to something else. I tried several and exactfit, letterbox and noborder all worked nicely. However, I started to notice that when the app went into the background and you double clicked on the home button to review background apps the image depicted for my LC app was all black. This never happened previously (the image was always whatever was on the screen when the app was "closed"). Puzzled by this I tried a few different things but when I commented out the "set fullscreenmode..." it reverted back to showing the screen in the background. Enabling fullscreenmode made it all black again. Any ideas? It would be a shame to have "fullscreenmode" available for scaling but to have to give-up the ability to see your app screen properly listed in the list of suspended apps. Not a deal breaker by any means, but certainly a nice cosmetic touch to have.

Cheers,
Mark
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

bwmilby
Posts: 351
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Suddenly resizing for a different size device

Post by bwmilby » Thu Oct 29, 2020 2:14 pm

iOS will automatically scale an app to fit the screen if designed for an older device. This comes from the days of the transition from 3GS to the 4 and the 4 to the 5. The size that the app is designed for used to be taken from the splash images. If you didn’t provide a splash for a certain size, then the OS assumed you didn’t support it and would scale from one that you did. LC includes one size by default.

The best way for you would be to install 9.6.1 instead of the hassle of specifying splash images. The method changed recently for depicting what is shown on the splash. If not an option, then just set a splash for the device you are using until you get back to your normal setup.

Due to the different aspect ratios of devices, I would advise against using a fullscreenmode to get the app to fill the screen. That would end up generating wasted space on the top/bottom or left/right.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5680
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Suddenly resizing for a different size device

Post by jacque » Thu Oct 29, 2020 5:56 pm

Note that splash screens on iOS are not what you think, and Apple calls them "launch screens." They should not be like a title page. Instead they should be a copy of the first screen in the app without any dynamic data. For a calendar app, it would be the blank calendar grid and any other static elements like buttons or layout items. The splash is displayed immediately before any of the app code runs. Apple says this is to give the user the impression of an immediate fast launch while the app itself loads in the background.
https://developer.apple.com/design/huma ... ch-screen/

While LC 9.6.1 does use an easier method of assigning launch screens (we used to need a dozen sizes or so) we do still need to supply at least one and three is better. Apple uses these for some screen calculations.

I usually make them by blanking out all the data from the first screen and taking a screenshot, then scaling them in an image app to the sizes I need. Maybe supplying these will solve some of the problems you're seeing.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Suddenly resizing for a different size device

Post by marksmithhfx » Thu Oct 29, 2020 9:28 pm

bwmilby wrote:
Thu Oct 29, 2020 2:14 pm
iOS will automatically scale an app to fit the screen if designed for an older device. This comes from the days of the transition from 3GS to the 4 and the 4 to the 5. The size that the app is designed for used to be taken from the splash images. If you didn’t provide a splash for a certain size, then the OS assumed you didn’t support it and would scale from one that you did. LC includes one size by default.
Ok, I think the light bulb is beginning to go on. So if I supply a set of splash screens as Jacque has described above (ie. just a copy of the 1st screen in the app) for various sizes then iOS will use the right size and scale the app to that. Correct?

That would be kind of nifty for sure and save a lot of hassle creating different sizes. Might even solve this dark screen problem (since fullscreenmode would not be used). Many things to investigate here. Will let you know how I get on.

Thanks all,
Mark
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 624
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Suddenly resizing for a different size device

Post by marksmithhfx » Thu Oct 29, 2020 9:31 pm

jacque wrote:
Thu Oct 29, 2020 5:56 pm
I usually make them by blanking out all the data from the first screen and taking a screenshot, then scaling them in an image app to the sizes I need. Maybe supplying these will solve some of the problems you're seeing.
Do you have a preferred set of sizes that covers the ratio gamut? PS thanks for the great advice. So much to know :)

Mark
macOS 10.15.7, Xcode 11.5, LC 9.6.1, iOS 13.6.1
Targets: Mac, iOS

kdjanz
Posts: 232
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Suddenly resizing for a different size device

Post by kdjanz » Fri Oct 30, 2020 3:32 am

Hi Jacque
While LC 9.6.1 does use an easier method of assigning launch screens (we used to need a dozen sizes or so) we do still need to supply at least one and three is better. Apple uses these for some screen calculations.
What 3 sizes work for you? Do you need 3 for a phone and 3 for an iPad or do you make a completely separate app for the iPad size?

Thanks

Kelly

Post Reply

Return to “iOS Deployment”