Ios – How to add a custom UIControl class in storyboard

iosobjective cstoryboardswiftuicontrol

I have a custom UIControl class that I want to use in my storyboard. I am having problems since there isn't a UIControl in the object library in the Storyboard console.

I tried adding a UIView and assigning my custom UIControl class to it, but it seems to not register the events that I need for the control to use(Value Changed, Touch Drag Inside, Touch Up Inside).

When debugging, I breakpointed the actions related to the events and it looks like they are not even called.

How can I use my custom UIControl class correctly in my storyboard?

Best Answer

You are doing it correctly -- drop a UIView onto your storyboard and assign the class in the Identity Inspector. Don't forget to override initWithCoder:aDecoder in the custom class.

Related Topic