From eecb8ad9950e5a79daf6c915b0e2fad580d77ecc Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 8 Feb 2023 14:09:31 +0000 Subject: [PATCH] UIViewComponentPeer: Call setNeedsUpdateOfSupportedInterfaceOrientations on orientation change --- .../native/juce_ios_UIViewComponentPeer.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 33b90e3caf..be3e8a6ee5 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -2192,8 +2192,14 @@ void Desktop::allowedOrientationsChanged() { if ([scene isKindOfClass: [UIWindowScene class]]) { - [static_cast (scene) requestGeometryUpdateWithPreferences: preferences.get() - errorHandler: ^([[maybe_unused]] NSError* error) + auto* windowScene = static_cast (scene); + + for (UIWindow* window in [windowScene windows]) + if (auto* vc = [window rootViewController]) + [vc setNeedsUpdateOfSupportedInterfaceOrientations]; + + [windowScene requestGeometryUpdateWithPreferences: preferences.get() + errorHandler: ^([[maybe_unused]] NSError* error) { // Failed to set the new set of supported orientations. // You may have hit this assertion because you're trying to restrict the supported orientations