我在
Swift中使用IBInspectable Int来选择4种形状(0-3),但是在故事板编辑器中可以设置大于3且小于0的值,这会阻止IBDesignable系统工作.
是否可以设置故事板编辑器中可以设置的值的最小和最大限制?
let SHAPE_CROSS = 0 let SHAPE_SQUARE = 1 let SHAPE_CIRCLE = 2 let SHAPE_TRIANGLE = 3 @IBInspectable var shapeType: Int = 0 @IBInspectable var shapeSize: CGFloat = 100.0 @IBInspectable var shapeColor: UIColor?