iOS window placement after re-orientation problem


#1

Hi,

Im having a problem with orientation on iOS. Create the basic default project with Introducer and put this in the DocumentWindow constructor in MainWindow.cpp

setResizable(true, false);
setFullScreen(true);
setVisible (true);

So, basically a simple fullscreen window.

When i run this on iOS, it comes up full screen (as you’d expect). turn it left (still fullscreen). press the desktop button (the thing on the iOS simulator that goes to the desktop). Then click on the icon for the app. i get this. notice the app window has “slid down a bit”

to explain a bit more, when you press the desktop button iOS goes back into portrait mode, perhaps without the app being aware. However, the app is still running because i havent selected another app at this time. pressing the app icon just continues the app and it comes back like this.

i’ve been through the code. it looks like it’s trying to do the right thing, fullscreen etc. but it doesnt quite work. if i make the window not full screen, it “moves” to the left somewhat after the same operation. i figure this is the same problem really.

any ideas? thanks,

– hugh.


#2

ok, after further investigation. this doesnt happen on my OS4.2 device because the “desktop button” always quits the app, rather than suspending it.

does OS5 suspend on desktop button or is this actually a simulator only weirdness?


#3

Weird. Can’t think of anything obvious… I wonder if the OS is shifting the window, rather than this being something the app is doing…


#4

i’ve done some more investigation and this could be a simulator issue. in which case, im not bothered about it. I need to try my test on an OS5 device to see what it does. OS4 never does it, but i am seeing some crashes instead. They may be another problem however :wink:

Up until now, i was assuming that the “desktop button” terminates the app. This might not be true anymore. im wondering if somehow some background thread might be running after pressing this button even though the UI thread is gone.

for example, i only recently discovered that pressing the off button, does not suspend all threads. presumably, it just suspends the UI thread. For example, if i play music in the background, it continues rather spookily whilst the unit is “off”. is there a JUCE event for the off button? for example is it equivalent to minimise/maximise.

thanks for any info.

– hugh.


#5

No, it’s a real issue. They way I’ve always reproduced it is, rotate landscape, home button. Then run something memory intensive. Last, resume the app in portrait. It’s there in iOS 3, 4, and 5.

The gap is the size of the status bar. What happens is that iOS sends an orientation has changed message right after the resume. Juce interogates the view size, and receives what you would expect (screen less status bar). But the status bar does not yet exist (it was ‘dumped’). After the fact, the status bar is reinserted, and the app view shifted down, which leaves the little black gap.

You can make it go away by rotating into landscape and rotating back. Strictly speaking, it appears to be an iOS bug, but I wouldn’t hold my breath on it getting fixed. It’s been on my lift of things to track down and fix but, being cosmetic, self correcting, and requiring a memory warning in alterered orientation to create, it’s been a low priority… :wink: