IBInspectable和浮点值

编程入门 行业动态 更新时间:2024-10-27 12:25:45
本文介绍了IBInspectable和浮点值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以在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和浮点值

本文发布于:2023-10-05 09:32:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467347.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浮点   IBInspectable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!