Search code examples
iosswiftobjective-cxcodeios11

Transparent Black Shade over the Navigation Bar in iPhone-X Later Notch Screen Devices in iOS App


I've configured app to support Notch Screen devices Running my App in the iPhone X Simulator.

the App is working fine in Normal views but does not use the full screen space if I have NAVIGATION CONTROLLERS

a strange Transparent Black Shade is appearing over the Navigation bar

Does anybody help me on this what is happening here and how to resolve this? I can't find any new settings in Interface Builder.


Solution

  • HI Please add the below code in Appdelegate did finish launch

    if (@available(iOS 13.0, *)) {
    
            UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.windowScene.statusBarManager.statusBarFrame];
    
            if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
    
                statusBar.backgroundColor = [UIColor whiteColor];
    
            }
    
            [[UIApplication sharedApplication].keyWindow addSubview:statusBar];
    
    
    
        } else {
            UIView *statusBar = [[UIView alloc]initWithFrame:[UIApplication sharedApplication].keyWindow.frame];
    
            if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
    
                statusBar.backgroundColor = [UIColor whiteColor];
    
            }
    
        }