Another screen size question (iphone6)

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulw
Posts: 8
Joined: Mon Jul 25, 2016 8:41 am

Another screen size question (iphone6)

Post by paulw » Mon Jul 25, 2016 9:08 am

I'm moving/updating one of my apps from android to iOs as well as from LC 6 to LC 8 and have an issue with the screen size suggested by LC 8 and what appears in the simulator for an iPhone 6 (and 6s).

I'm a little bit rusty on the LC mobile side as it's been a couple of years since I've needed to do anything other than desktop apps, so to check I knew what I was doing I started with just a simple 1 screen, 1 button app.

I created a new stack and used the LC suggestion for iPhone 6 (375 x 667). I added 1 button and set it to be on the right hand side of the screen.

When I run it via the simulator (hardware set as iPhone 6 or 6s) the button is mostly off screen.

I've had the simple app report the screen resolution (via iphoneDeviceResolution) and it returns 640,1136.

If I work with a stack size of 320 x 568 everything fits fine - am I doing something wrong or is the LC suggested size wrong? I've played around with pixelscale and fullscreenmode but nothing seems to get the suggested 375x667 (at any scale) to fit.

Fjord
Posts: 132
Joined: Sat Dec 06, 2008 6:18 pm
Location: France

Re: Another screen size question (iphone6)

Post by Fjord » Mon Jul 25, 2016 2:02 pm

Hi,
I had the same problem just yesterday. I read this lesson http://lessons.livecode.com/m/4069/l/28 ... esolutions which is about positioning (by script) your buttons, fields etc. BUT the example defines the position of each element by using the width and height of this stack. That seems to be the width / height of the stack in the IDE, which can not adapt to each different mobile.

After experimenting, I found I should use instead "the working screenRect" to get the dimensions of the screen of the target mobile:

Code: Select all

private command putThingsIntoPlace
   if the environment = "mobile" then get the working screenRect
   else get the rect of this cd
   put item 3 of it - item 1 of it into theWidth
   put item 4 of it - item 2 of it into theHeight
...
then compute the coordinate of each element using theWidth and theHeight.
Hope this helps.
--
François

paulw
Posts: 8
Joined: Mon Jul 25, 2016 8:41 am

Re: Another screen size question (iphone6)

Post by paulw » Tue Jul 26, 2016 1:47 pm

François,

Thanks - not quite what I was looking for but it did give me the push to look at the problem again.

The issue was - there wasn't an issue!

All I need to do was set fullscreenmode to "exactFit" and leave it at that. Instead I decide to make a call to iphoneDeviceResolution() right at the start and because that misreports the size of the iPhone 6 & 6s on the simulator as 640, 1136 I then stated down the rabbit hole and never thought to just do what all the examples suggested.

Post Reply

Return to “iOS Deployment”