简体   繁体   中英

iOS10 UIColor Change

In Apple developer Document, I found something new in UIColor.

If your app was linked on or after iOS 10 and when running on iOS 10 or later, colors are created in extended color spaces:

kCGColorSpaceExtendedGray

kCGColorSpaceExtendedSRGB

When working in an extended color space, color values are not clamped to fit inside the color gamut, meaning that component values may be less than 0.0 or greater than 1.0. When displayed on an sRGB display, such colors are outside the gamut and will not be rendered accurately. However, extended color spaces are useful working color spaces when you want a pixel format and representation that other color spaces can be easily converted into. For example, a color in the display P3 color space that is not within the sRGB color gamut can still be converted to an extended sRGB format. Some of its values will be outside of the 0.0 to 1.0 range. However, when displayed on a device with a P3 display gamut, it would still be rendered correctly.

To summarize, when you need to worry about color spaces, use these extended color spaces as working color spacs. When you need to worry about representing that color as closely as possible in a specific color space, convert the color from the extended color space into the target color space.

I just can't understand that, and the debug areas showed UIExtendedGrayColorSpace 0 0 when I wanted to debug some view's background in Xcode8. So what color is that?

I am not 100% certain, but from what I have seen...

UIExtendedGrayColorSpace 0 0 is "clear" and UIExtendedGrayColorSpace 1 1 is white.

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