IOS 10宽色:我需要担心吗? [英] IOS 10 Wide Color: Do I need to be concerned?

查看:105
本文介绍了IOS 10宽色:我需要担心吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 10的发行说明标题为广泛颜色的部分。

令我迷茫的行是这一个:
如果您的应用程序依赖于UIKit来钳制组件值(无论您是创建颜色还是要求颜色获取其组件值),您需要在链接时更改应用程序的行为iOS 10。

The line that has me confused is this one: If your app relies on UIKit to clamp component values (whether you’re creating a color or asking a color for its component values), you need to change your app’s behavior when you link against iOS 10.

钳制组件值意味着什么?在objective-c或swift中看起来是什么样的?如何更新它以符合iOS 10中的更改?

What does it mean to clamp component values?? What does that look like in objective-c or swift and how would I update it to comply with the changes coming in iOS 10?

推荐答案

该行在上下文中更有意义:

That line makes a bit more sense in context:


在iOS 10中, UIColor class使用扩展的sRGB颜色空间,其初始值设定项不再将原始组件值限制在 0.0 1.0 之间。如果您的应用程序依赖于UIKit来锁定组件值(无论您是创建颜色还是要求颜色显示其组件值),您需要在链接iOS 10时更改应用程序的行为。

In iOS 10, the UIColor class uses the extended sRGB color space and its initializers no longer clamp raw component values to between 0.0 and 1.0. If your app relies on UIKit to clamp component values (whether you’re creating a color or asking a color for its component values), you need to change your app’s behavior when you link against iOS 10.

将原始组件值钳制到 0.0 1.0之间表示当您将旧API传递给 0.0 以下的值时,它将使用 0.0 相反,当您传递旧API时,其价值高于 1.0 ,而是使用 1.0

"Clamp[ing] raw component values to between 0.0 and 1.0" means that when you passed the old API a value below 0.0, it would use 0.0 instead, and when you passed the old API a value above 1.0 it would use 1.0 instead.

UIKit不再这样做了。在新的扩展sRGB颜色空间中,RGB三元组如(1.0,0.0,0.0)意味着像sRGB一样红,但现在也可以创建颜色如(1.1,0.0,0.0) 甚至更红

UIKit no longer does this. In the new extended-sRGB color space, an RGB triplet like (1.0, 0.0, 0.0) means "as red as sRGB can get", but it's now also possible to create colors like (1.1, 0.0, 0.0) that are even redder.

如果在iOS 9或更早版本中,您将 0.0 - 1.0 范围之外的值传递给 UIColor ,现在它将接受这些值,因此您现在将获得与之前不同的颜色。如果您之前只传过该范围内的值,那么您就没有任何变化。

If in iOS 9 or earlier you were passing values outside the 0.0-1.0 range to UIColor, it'll now accept those values, so you'll now get different colors than you did before. If you were only ever passing values in that range before, then there's no change for you.

如评论中所述, WWDC16广告色彩会议

这篇关于IOS 10宽色:我需要担心吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆