简体   繁体   中英

How to detect iOS Screen is OLED?

On LED Screens it is quite common to use an off black (almost black). But on iPhone X' OLED screen this feels not the way to go. Pure black is what I want.

Is there a way to detect if the screen is an OLED type? (Rather than check if it is an iPhone X)

Also is there a way to distinguish the screen type within the Storyboard?

You can try to send displayConfiguration message to mainScreen instance of UIScreen and get access to the FBSDisplayConfiguration struct, but I'm not sure, that this code will be approved if you send it to the App Store:

UIScreen *mainScreen = [UIScreen mainScreen];
SEL selector = NSSelectorFromString(@"displayConfiguration");
id displayConfiguration = [mainScreen performSelector:selector];

Here is displayConfiguration for my iPhone SE:

<FBSDisplayConfiguration: 0x1c417fec0; Main; mode: "320x568@2x 60Hz sRGB SDR"> {
    CADisplay.name = LCD;
    CADisplay.deviceName = primary;
    CADisplay.seed = 2;
    tags = 0;
    currentMode = <FBSDisplayMode: 0x1c4094d70; 320x568@2x (640x1136/2) 60Hz sRGB SDR>;
    safeOverscanRatio = {0.89999997615814209, 0.89999997615814209};
    nativeCenter = {320, 568};
    pixelSize = {640, 1136};
    bounds = {{0, 0}, {320, 568}};
    CADisplay = <CADisplay:LCD primary>;
}

It seems that CADisplay is also a part of private API.

PS: I don't have ability to test these code on the iPhone X, if you have—please, let me know which is value of CADisplay.name . I'm interesting too :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM