diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 6c1f7efd14..e5ef2be186 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -118,6 +118,8 @@ using namespace juce; - (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation duration: (NSTimeInterval) duration; - (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation; - (void) viewWillTransitionToSize: (CGSize) size withTransitionCoordinator: (id) coordinator; +- (BOOL) prefersStatusBarHidden; +- (UIStatusBarStyle) preferredStatusBarStyle; - (void) viewDidLoad; - (void) viewWillAppear: (BOOL) animated; @@ -298,6 +300,15 @@ static void sendScreenBoundsUpdate (JuceUIViewController* c) juceView->owner->updateTransformAndScreenBounds(); } +static bool isKioskModeView (JuceUIViewController* c) +{ + JuceUIView* juceView = (JuceUIView*) [c view]; + jassert (juceView != nil && juceView->owner != nullptr); + + return Desktop::getInstance().getKioskModeComponent() == &(juceView->owner->getComponent()); +} + + } // (juce namespace) //============================================================================== @@ -339,6 +350,16 @@ static void sendScreenBoundsUpdate (JuceUIViewController* c) MessageManager::callAsync ([=]() { sendScreenBoundsUpdate (self); }); } +- (BOOL) prefersStatusBarHidden +{ + return isKioskModeView (self); +} + +- (UIStatusBarStyle) preferredStatusBarStyle +{ + return UIStatusBarStyleDefault; +} + - (void) viewDidLoad { sendScreenBoundsUpdate (self); @@ -991,13 +1012,15 @@ bool UIViewComponentPeer::canBecomeKeyWindow() //============================================================================== void Desktop::setKioskComponent (Component* kioskModeComp, bool enableOrDisable, bool /*allowMenusAndBars*/) { - [[UIApplication sharedApplication] setStatusBarHidden: enableOrDisable - withAnimation: UIStatusBarAnimationSlide]; - displays->refresh(); - if (ComponentPeer* const peer = kioskModeComp->getPeer()) + if (ComponentPeer* peer = kioskModeComp->getPeer()) + { + if (UIViewComponentPeer* uiViewPeer = dynamic_cast (peer)) + [uiViewPeer->controller setNeedsStatusBarAppearanceUpdate]; + peer->setFullScreen (enableOrDisable); + } } //============================================================================== diff --git a/modules/juce_gui_basics/native/juce_ios_Windowing.mm b/modules/juce_gui_basics/native/juce_ios_Windowing.mm index 10a9607f94..094cca36a3 100644 --- a/modules/juce_gui_basics/native/juce_ios_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_ios_Windowing.mm @@ -357,8 +357,7 @@ void Desktop::Displays::findDisplays (float masterScale) UIScreen* s = [UIScreen mainScreen]; Display d; - d.userArea = UIViewComponentPeer::realScreenPosToRotated (convertToRectInt ([s bounds])) / masterScale; - d.totalArea = UIViewComponentPeer::realScreenPosToRotated (convertToRectInt ([s bounds])) / masterScale; + d.userArea = d.totalArea = UIViewComponentPeer::realScreenPosToRotated (convertToRectInt ([s bounds])) / masterScale; d.isMain = true; d.scale = masterScale;