Search code examples
xcodeswiftibaction

IBDesignable... adding custom actions?


I'm new to Xcode and I assume there's a way to do it but I can't seem to figure it out.

I have made a custom control by subclassing UIView and using IBDesignable.

However, I can't seem to figure out how to send events from within my control to a IBAction outside of it.


Solution

  • You need to subclass UIControl not UIView. Once Interface Builder sees an UIControl subclass then send events section and actions will be available.

    Accessing the Control’s Targets and Actions