How to add a custom UIControl class in storyboard?

3254523 picture 3254523 · Sep 6, 2014 · Viewed 9.6k times · Source

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?

Answer

memmons picture memmons · Sep 6, 2014

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.