I’m trying to get a JUCE-based iOS application to properly resize when the device (iPad) is turned. The project has an AudioProcessorEditor subclass where I implement parentSizeChanged() and resized(). When I detect in parentSizeChanged() that the desktop bounds have changed, I call setSize with the new bounds. Funnily, this leads to multiple calls (4 to be exact) of the resized() method, with varying values for the result of a call to getWidth():
Example for a rotation from landscape to portrait (the app was started in landscape mode and only displays this one correctly):
first call of resized(): getWidth() returns 1004 (1024-menu bar height)
second call of resized(): getWidth() returns 768 (yep, that’s what we want!)
third call of resized(): getWidth() returns 1004 :?
fourth call of resized(): getWidth() returns 1024
I assume that my approach is not the right one. But how do you do this correctly? Thanks in advance for any suggestions!
Ok, I could solve the problem myself. The solution is to define the entire application as full screen. In my case this means calling mainWindow->setFullScreen(true); (mainWindow is a StandaloneFilterWindow).
Just out of curiosity: what is the right place to make changes that depend on the orientation of the device (besides resizing, which has been solved now)? Is it in the resized() method? I searched a bit in the JUCE source code for shouldRotate, shouldAutorotateToInterfaceOrientation, willAutorotateToInterfaceOrientation and didAutorotateFromInterfaceOrientation, and looked at the methods that are getting called from there, but it doesn’t seem like there is a JUCE-specific (not iOS-specific) method that will get called from these methods. Will there be such a method at some point or is it simply not necessary?