Reputation: 14562
I have a custom class that inherits from UIControl, to get touch events. It's basically a collection of other controls that acts as one. I'm converting my app from xibs to a storyboard. It's been mostly painless, except for this.
I drag a UIView into my scene, change the class to my custom control, hook it up to outlets on my ViewController. What I want to do with the control when it's clicked is perform a (push) segue to another ViewController. But the outlets in the designer aren't there for my UIControl to set up the segue.
Is it possible to do this? If so, what do I do to the class to enable that?
Upvotes: 12
Views: 1232
Reputation: 2910
I don't think so. Looking at the Connections Inspector pane, UIButton
and UIBarButtonItem
instances get special treatment—an extra "triggered segues" action you can connect to adjacent view controllers:
While changing your view's class to a descendent of UIControl
makes the standard suite of control events available, unfortunately Interface Builder does not let you hook up a segue. The best you can do is create a manually-triggered segue from your view controller to another, then connect your custom control to an IBAction
method that performs the segue programmatically:
- (IBAction)performManualSegue:(XYZCustomControl *)sender
{
[self performSegueWithIdentifier:@"manualPushSegue" sender:sender];
}
Upvotes: 8