gpt4 book ai didi

ios - @IBInspectable 与枚举?

转载 作者:IT老高 更新时间:2023-10-28 11:24:02 25 4
gpt4 key购买 nike

我想创建 @IBInspectable 元素,如下图所示:

enter image description here

我的想法是使用 enum 之类的东西作为 @IBInspectable 的类型,但看起来情况并非如此,有什么想法如何实现这样的元素吗?

编辑:

看起来 @IBInspectable 只支持这些类型:

  • 整数
  • CGFloat
  • 字符串
  • bool 型
  • CGPoint
  • CGSize
  • CGRect
  • UIColor
  • UIImage

无赖

最佳答案

这是不可能的(目前)。您只能使用在用户定义的运行时属性部分中看到的那些类型。

来自 Apple 的 doc :

You can attach the IBInspectable attribute to any property in a class declaration, class extension, or category for any type that’s supported by the Interface Builder defined runtime attributes: boolean, integer or floating point number, string, localized string, rectangle, point, size, color, range, and nil.

关于ios - @IBInspectable 与枚举?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28749598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com