Skip to content

can hide status bar on iOS #17179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/bevy_window/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,16 @@ pub struct Window {
///
/// [`WindowAttributesExtIOS::with_prefers_home_indicator_hidden`]: https://docs.rs/winit/latest/x86_64-apple-darwin/winit/platform/ios/trait.WindowAttributesExtIOS.html#tymethod.with_prefers_home_indicator_hidden
pub prefers_home_indicator_hidden: bool,
/// Sets whether the Window prefers the status bar hidden.
///
/// Corresponds to [`WindowAttributesExtIOS::with_prefers_status_bar_hidden`].
///
/// # Platform-specific
///
/// - Only used on iOS.
///
/// [`WindowAttributesExtIOS::with_prefers_status_bar_hidden`]: https://docs.rs/winit/latest/x86_64-apple-darwin/winit/platform/ios/trait.WindowAttributesExtIOS.html#tymethod.with_prefers_status_bar_hidden
pub prefers_status_bar_hidden: bool,
}

impl Default for Window {
Expand Down Expand Up @@ -454,6 +464,7 @@ impl Default for Window {
titlebar_show_title: true,
titlebar_show_buttons: true,
prefers_home_indicator_hidden: false,
prefers_status_bar_hidden: false,
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ impl WinitWindows {
use winit::platform::ios::WindowAttributesExtIOS;
winit_window_attributes = winit_window_attributes
.with_prefers_home_indicator_hidden(window.prefers_home_indicator_hidden);
winit_window_attributes = winit_window_attributes
.with_prefers_status_bar_hidden(window.prefers_status_bar_hidden);
}

let display_info = DisplayInfo {
Expand Down
2 changes: 2 additions & 0 deletions examples/mobile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ fn main() {
recognize_rotation_gesture: true,
// Only has an effect on iOS
prefers_home_indicator_hidden: true,
// Only has an effect on iOS
prefers_status_bar_hidden: true,
..default()
}),
..default()
Expand Down
Loading