From 9f080a5d2fe30e8d323ded0f825faac8f499b88f Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 10 Sep 2024 10:17:22 +0200 Subject: [PATCH] Always redraw when the safe area changes --- src/platform_impl/apple/uikit/view.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/platform_impl/apple/uikit/view.rs b/src/platform_impl/apple/uikit/view.rs index b0b97b1eb4..a5d3d45e44 100644 --- a/src/platform_impl/apple/uikit/view.rs +++ b/src/platform_impl/apple/uikit/view.rs @@ -11,6 +11,7 @@ use objc2_ui_kit::{ UIResponder, UIRotationGestureRecognizer, UITapGestureRecognizer, UITextInputTraits, UITouch, UITouchPhase, UITouchType, UITraitEnvironment, UIView, }; +use tracing::debug; use super::app_state::{self, EventWrapper}; use super::window::WinitUIWindow; @@ -136,6 +137,13 @@ declare_class!( ); } + #[method(safeAreaInsetsDidChange)] + fn safe_area_changed(&self) { + debug!("safeAreaInsetsDidChange was called, requesting redraw"); + // When the safe area changes we want to make sure to emit a redraw event + self.setNeedsDisplay(); + } + #[method(touchesBegan:withEvent:)] fn touches_began(&self, touches: &NSSet, _event: Option<&UIEvent>) { self.handle_touches(touches)