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?
1. Drag UIView to your Design file 2. Replace default 'class name' in Identity Inspector of this Control from UIView to TwicketSegmentedControl 3. (Important step) Also Assign 'Module Name' below 'class name' in Identity Inspector to TwicketSegmentedControl.
In the storyboard, open the Assistant editor; it should display ViewController. swift. To create the outlet, click the Knob and control-drag it right underneath the animateSwitch IBOutlet . Release the drag and, in the pop-up window, name the outlet knob then click Connect.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With