IBDesignable...添加自定义操作?

IBDesignable... adding custom actions?

我是 Xcode 的新手,我认为有一种方法可以做到,但我似乎无法弄清楚。

我通过子类化 UIView 并使用 IBDesignable 制作了自定义控件。

但是,我似乎无法弄清楚如何将我控制范围内的事件发送到它之外的 IBAction。

您需要继承 UIControl 而不是 UIView。一旦 Interface Builder 看到 UIControl 子类,然后发送事件部分和操作将可用。

Accessing the Control’s Targets and Actions