iOS: Show the status bar (overlay style) in portrait mode.

This commit is contained in:
Henrik Rydgård
2025-10-28 01:11:52 +01:00
parent 31d13e14ef
commit df9c575a22
4 changed files with 45 additions and 7 deletions
-4
View File
@@ -43,8 +43,6 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
@@ -54,8 +52,6 @@
<string>public.app-category.games</string>
<key>GCSupportsGameMode</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
+3 -3
View File
@@ -196,6 +196,9 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) {
self.glView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.glView];
self.view.insetsLayoutMarginsFromSafeArea = NO;
self.view.clipsToBounds = YES;
// Put context current for initial GL setup
[EAGLContext setCurrentContext:self.glContext];
@@ -337,9 +340,6 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) {
g_Config.Save("shutdown GL");
_dbg_assert_(sharedViewController != nil);
sharedViewController = nil;
_dbg_assert_(graphicsContext);
if (self.context) {
+39
View File
@@ -40,6 +40,12 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate:) name:UIApplicationWillTerminateNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(controllerDidConnect:) name:GCControllerDidConnectNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(controllerDidDisconnect:) name:GCControllerDidDisconnectNotification object:nil];
// Observe orientation changes
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onOrientationChanged)
name:UIDeviceOrientationDidChangeNotification
object:nil];
}
self.accelerometerQueue = [[NSOperationQueue alloc] init];
self.accelerometerQueue.name = @"AccelerometerQueue";
@@ -395,5 +401,38 @@ static float BoostInset(float inset) {
}
#endif
#pragma mark - Status Bar Control
// iOS calls this to determine whether to hide the status bar
- (BOOL)prefersStatusBarHidden {
UIInterfaceOrientation orientation;
if (@available(iOS 13.0, *)) {
UIWindowScene *scene = self.view.window.windowScene;
if (scene != nil) {
orientation = scene.interfaceOrientation;
} else {
orientation = UIApplication.sharedApplication.statusBarOrientation;
}
} else {
orientation = UIApplication.sharedApplication.statusBarOrientation;
}
BOOL isLandscape = UIInterfaceOrientationIsLandscape(orientation);
bool userWantsStatusBar = true; // g_Config.bShowStatusBar;
// return isLandscape || !userWantsStatusBar;
return false;
}
// Optional: choose light/dark text for the status bar
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
// This should also be called when the user preference changes.
- (void)onOrientationChanged {
[self setNeedsStatusBarAppearanceUpdate];
}
@end
+3
View File
@@ -347,6 +347,9 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye
UIScreen* screen = [(AppDelegate*)[UIApplication sharedApplication].delegate screen];
self.view.frame = [screen bounds];
self.view.multipleTouchEnabled = YES;
self.view.insetsLayoutMarginsFromSafeArea = NO;
self.view.clipsToBounds = YES;
graphicsContext = new IOSVulkanContext();
[[DisplayManager shared] updateResolution:[UIScreen mainScreen]];