Objective-J Objective-J - 1 year ago 58
Objective-C Question

How to use Storyboards with multiple segues to one view controller?

My app will use a simple login type selcector view controller, and from that it'll branch out to different view controllers, i.e. Sign Up, Sign In, and Sign In with Social networks. Now how do I add a segue from all of these to one single destination view controller. How do I add these multiple segues.

Answer Source

Every ViewController should have their own seque. To create, press "Ctrl" and move to the ViewController you want

enter image description here

And every ViewController should implement "prepareForSegue"

- (void)prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender {
    if ([segue.destinationViewController isKindOfClass:[MyDestinationVC class]]) {
        //do something
        MyDestinationVC *screen = (MyDestinationVC *)segue.destinationViewController;
        screen.someValue = self.sendedValue;