Skip to content

Commit

Permalink
Always redraw when the safe area changes
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 10, 2024
1 parent da7942e commit 9f080a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/platform_impl/apple/uikit/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<UITouch>, _event: Option<&UIEvent>) {
self.handle_touches(touches)
Expand Down

0 comments on commit 9f080a5

Please sign in to comment.