是否可以在Attributes Inspector中设置浮点值?我在我的UIView中有这个属性:
Is it possible to set floating point value in Attributes Inspector? I have this property in my UIView:
@IBInspectable var scale: CGFloat = 0.90 { didSet { setNeedsDisplay() } }尽可能看,默认值是0.9,我想在Attributes Inspector中更改它,但它看起来像:
As you can see, default value is 0.9 and I would like to change it in Attributes Inspector, but it looks like that:
我只能在那里设置整数值。我错过了什么吗?
And I am only able to set integer values in there. Am I missing something?
推荐答案你可以设置它。对我来说有用的是在输入数字而不是句号时使用逗号。正如@Alladinian评论的那样:
You can set it. What worked for me was using a comma when entering the number instead of a period. And as commented by @Alladinian:
[T]小数点分隔符[可能只是]区域设置(区域)依赖。
[T]he decimal separator [might just be] locale (region) dependant.
这是 0,5 ,而不是 0.5 :
Here it's 0,5, not 0.5:
这里是 0,8 ,而不是 0.8 :
Here it's 0,8, not 0.8:
更多推荐
IBInspectable和浮点值
发布评论