diff options
-rw-r--r-- | src/ios.m | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -302,6 +302,24 @@ iBool processEvent_iOS(const SDL_Event *ev) { | |||
302 | postCommandf_App("os.theme.changed dark:%d contrast:1", isSystemDarkMode_ ? 1 : 0); | 302 | postCommandf_App("os.theme.changed dark:%d contrast:1", isSystemDarkMode_ ? 1 : 0); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | else if (equal_Command(cmd, "theme.changed")) { | ||
306 | if (@available(iOS 13.0, *)) { | ||
307 | /* SDL doesn't expose this as a setting, so we'll rely on a hack. | ||
308 | Adding an SDL hint for this would be a cleaner solution than calling | ||
309 | a private method. */ | ||
310 | UIViewController *vc = viewController_(get_Window()); | ||
311 | SEL sel = NSSelectorFromString(@"setStatusStyle:"); /* custom method */ | ||
312 | if ([vc respondsToSelector:sel]) { | ||
313 | NSInvocation *call = [NSInvocation invocationWithMethodSignature: | ||
314 | [NSMethodSignature signatureWithObjCTypes:"v@:i"]]; | ||
315 | [call setSelector:sel]; | ||
316 | int style = isDark_ColorTheme(colorTheme_App()) ? | ||
317 | UIStatusBarStyleLightContent : UIStatusBarStyleDarkContent; | ||
318 | [call setArgument:&style atIndex:2]; | ||
319 | [call invokeWithTarget:vc]; | ||
320 | } | ||
321 | } | ||
322 | } | ||
305 | } | 323 | } |
306 | return iFalse; /* allow normal processing */ | 324 | return iFalse; /* allow normal processing */ |
307 | } | 325 | } |