Question

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.

Était-ce utile?

La solution

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
        //Example
        MyDestinationVC *screen = (MyDestinationVC *)segue.destinationViewController;
        screen.someValue = self.sendedValue;
    }
}

Autres conseils

If you have segues between one view(LoginVC) to others (login, social login, etc...) System already knows last viewcontroller from which you came to newer viewcontroller. You just execute [self dismissViewControllerAnimated:YES completion:nil]; or put system barbuttons like UIBarButtonSystemItemDone to take care of dismissal by system itself to go back.

Unless you have some other problem, this solution should work for you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top