diff --git a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm index 1daab29f74..f3545d2405 100644 --- a/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm @@ -86,23 +86,6 @@ namespace Orientations } } -struct AsyncBoundsUpdater : public AsyncUpdater -{ - AsyncBoundsUpdater (UIViewController* vc) - : viewController (vc) - { - } - - ~AsyncBoundsUpdater() override - { - cancelPendingUpdate(); - } - - void handleAsyncUpdate() override; - - UIViewController* viewController; -}; - //============================================================================== } // namespace juce @@ -136,8 +119,6 @@ using namespace juce; //============================================================================== @interface JuceUIViewController : UIViewController { -@public - std::unique_ptr boundsUpdater; } - (JuceUIViewController*) init; @@ -287,11 +268,6 @@ static void sendScreenBoundsUpdate (JuceUIViewController* c) juceView->owner->updateScreenBounds(); } -void AsyncBoundsUpdater::handleAsyncUpdate() -{ - sendScreenBoundsUpdate ((JuceUIViewController*) viewController); -} - static bool isKioskModeView (JuceUIViewController* c) { JuceUIView* juceView = (JuceUIView*) [c view]; @@ -312,8 +288,6 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; { self = [super init]; - boundsUpdater = std::make_unique (self); - return self; } @@ -345,12 +319,10 @@ MultiTouchMapper UIViewComponentPeer::currentTouches; - (void) viewWillTransitionToSize: (CGSize) size withTransitionCoordinator: (id) coordinator { [super viewWillTransitionToSize: size withTransitionCoordinator: coordinator]; - sendScreenBoundsUpdate (self); - - // On some devices the screen-size isn't yet updated at this point, so also trigger another - // async update to double-check.. - if (boundsUpdater != nullptr) - boundsUpdater->triggerAsyncUpdate(); + [coordinator animateAlongsideTransition: nil completion: ^void (id) + { + sendScreenBoundsUpdate (self); + }]; } - (BOOL) prefersStatusBarHidden @@ -580,8 +552,6 @@ UIViewComponentPeer::~UIViewComponentPeer() currentTouches.deleteAllTouchesForPeer (this); Desktop::getInstance().removeFocusChangeListener (this); - ((JuceUIViewController*) controller)->boundsUpdater = nullptr; - view->owner = nullptr; [view removeFromSuperview]; [view release];