美文网首页
iOS13 获取statusBar

iOS13 获取statusBar

作者: iOS门三闫 | 来源:发表于2019-11-06 14:57 被阅读0次

if (@available(iOS 13.0, *)) {

            UIStatusBarManager *statusBarManager = [[[UIApplication sharedApplication] windows] objectAtIndex:0].windowScene.statusBarManager;

            if ([statusBarManager respondsToSelector:@selector(createLocalStatusBar)]) {

                UIView *_localStatusBar = [statusBarManager performSelector:@selector(createLocalStatusBar)];

                if ([_localStatusBar respondsToSelector:@selector(statusBar)]) {

                    _statusBar = [_localStatusBar performSelector:@selector(statusBar)];

                }

            }

        } else {

            // Fallback on earlier versions

            _statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];

        }

相关文章

网友评论

      本文标题:iOS13 获取statusBar

      本文链接:https://www.haomeiwen.com/subject/jqpubctx.html