Merge PR #357: Fix setting iOS status bar color with new xcode apis
This commit is contained in:
commit
5135eb0668
@ -1 +1 @@
|
|||||||
Subproject commit ebb0b68be41f4559a4785db5951b7d8cfa042e6e
|
Subproject commit d97317e856d55a2f5399f17888f1852fee8b9553
|
||||||
@ -102,8 +102,18 @@ void PlatformHelperIOS::generateNotificationFeedback()
|
|||||||
|
|
||||||
void PlatformHelperIOS::setTopPanelColorInternal(const QColor &color)
|
void PlatformHelperIOS::setTopPanelColorInternal(const QColor &color)
|
||||||
{
|
{
|
||||||
UIView *statusBar = (UIView *)[[UIApplication sharedApplication] valueForKey:@"statusBar"];
|
if (@available(iOS 13.0, *)) {
|
||||||
statusBar.backgroundColor = [UIColor colorWithRed:color.redF() green:color.greenF() blue:color.blueF() alpha:color.alphaF()];
|
UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame];
|
||||||
|
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
|
||||||
|
statusBar.backgroundColor = [UIColor colorWithRed:color.redF() green:color.greenF() blue:color.blueF() alpha:color.alphaF()];
|
||||||
|
}
|
||||||
|
[[UIApplication sharedApplication].keyWindow addSubview:statusBar];
|
||||||
|
} else {
|
||||||
|
UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.frame];
|
||||||
|
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
|
||||||
|
statusBar.backgroundColor = [UIColor colorWithRed:color.redF() green:color.greenF() blue:color.blueF() alpha:color.alphaF()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (((color.red() * 299 + color.green() * 587 + color.blue() * 114) / 1000) > 123) {
|
if (((color.red() * 299 + color.green() * 587 + color.blue() * 114) / 1000) > 123) {
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
|
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
|
||||||
|
|||||||
Reference in New Issue
Block a user