Browse Source

Removed an iOS deprecated function in setKioskComponent()

tags/2021-05-28
jules 9 years ago
parent
commit
ceb1b405f0
2 changed files with 28 additions and 6 deletions
  1. +27
    -4
      modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm
  2. +1
    -2
      modules/juce_gui_basics/native/juce_ios_Windowing.mm

+ 27
- 4
modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm View File

@@ -118,6 +118,8 @@ using namespace juce;
- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation duration: (NSTimeInterval) duration;
- (void) didRotateFromInterfaceOrientation: (UIInterfaceOrientation) fromInterfaceOrientation;
- (void) viewWillTransitionToSize: (CGSize) size withTransitionCoordinator: (id<UIViewControllerTransitionCoordinator>) 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<UIViewComponentPeer*> (peer))
[uiViewPeer->controller setNeedsStatusBarAppearanceUpdate];
peer->setFullScreen (enableOrDisable);
}
}
//==============================================================================


+ 1
- 2
modules/juce_gui_basics/native/juce_ios_Windowing.mm View File

@@ -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;


Loading…
Cancel
Save