orientationChanged vs. resizeStack on iPhone

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bamakojeff
Posts: 33
Joined: Tue Dec 06, 2022 6:53 pm

orientationChanged vs. resizeStack on iPhone

Post by bamakojeff » Thu Mar 13, 2025 3:23 am

According to the docs, "The orientationChanged message is sent before any automatic interface rotation takes place..." and "The resizeStack message is sent after the resizing is finished." But on my iPhone 12, at least, I am seeing "weirdness".

I have the following code:

Code: Select all

on orientationChanged
  log "orientationChanged"
end orientationChanged

on resizeStack pNewW, pNewH, pOldW, pOldH
  log "resizeStack"
  send "updateInterface" to me in 0 milliseconds
end resizeStack

on updateInterface
  log "updateInterface"
end updateInterface
Given that orientationChanged fires before the screen rotates and resizeStack fires after, you would expect to see
orientationChanged
resizeStack
updateinterface
over and over again every time you rotate the device. And sometime you do see that. But other times you see the opposite - resizeStack first followed by orientationChanged.

Here is the log off my iPhone 12 as I rotate my device from "portrait" to "landscape left" and back again.
orientationChanged
resizeStack
updateInterface
resizeStack
updateInterface
orientationChanged
resizeStack
updateInterface
orientationChanged
orientationChanged
resizeStack
updateInterface
resizeStack
updateInterface
orientationChanged
There doesn't seem to be any rhyme or reason to it. Sometimes one fires first, and sometimes the other does. My macbook is too old and slow to run the xcode simulator without crashing, so I haven't tried this on anything but my physical iPhone. I'll get a hold of my son's macbook and try this one the simulator and see if it still happens. But is there something obvious I'm missing? Do I not understand how this message path works? Is my phone messed up?

Post Reply