diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-17 13:15:39 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-17 13:15:39 +0300 |
commit | 226520d798d1f1bc9b9a8de1bc9082080c20ff7a (patch) | |
tree | 995f7d7393cfd535e73790d78cd59ac08cc4575f /src | |
parent | 69d37a99b91297bd26311a245923af56b6c444fe (diff) |
iOS: Change status bar style
TODO for a later: add a new SDL hint for controlling the iOS status bar style.
Diffstat (limited to 'src')
-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 | } |