Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios IBInspectable不适用于Int或UInt_Ios_Xcode_Ibinspectable - Fatal编程技术网

Ios IBInspectable不适用于Int或UInt

Ios IBInspectable不适用于Int或UInt,ios,xcode,ibinspectable,Ios,Xcode,Ibinspectable,上面的代码显示一条消息 无法设置(numLines)用户定义的已检查属性 UIViewNewClass[setValue:forUndefinedKey:]:该类不符合键numline的键值编码 它确实与另一个IBInspectable属性(即UIColor)一起工作 iInspectable是否与Int或UInt一起工作,或者我在这里做错了什么,或者它只与NSNumber一起工作?它应该与Int、UInt或任何其他数字类型一起工作。我已经用下面的代码在本地验证了这一点: @IBInspecta

上面的代码显示一条消息

无法设置(numLines)用户定义的已检查属性

UIViewNewClass[setValue:forUndefinedKey:]:该类不符合键numline的键值编码

它确实与另一个
IBInspectable
属性(即
UIColor
)一起工作


iInspectable
是否与
Int
UInt
一起工作,或者我在这里做错了什么,或者它只与
NSNumber
一起工作?

它应该与
Int
UInt
或任何其他数字类型一起工作。我已经用下面的代码在本地验证了这一点:

@IBInspectable  var numLines:UInt! = 2

这将按预期在interface builder中显示和工作。我会确保您的类定义中有@IBDesignable,并尝试进行清理和删除派生数据。

是的,我进行了清理和构建,但这不起作用。因此,关闭Xcode,再次打开它,然后它就可以正常工作了。
@IBDesignable
class TestViewController: UIViewController {
    ...

    @IBInspectable var test: UInt = 0

    ...
}