I am working on a project where I am calling several segues instead of using Navigation Controllers.
Earlier in my project, I setup a modal segue, and called it from within the IBAction method of several different buttons (I call the same segue from different buttons as I am passing a string along with the segue).
In my storyboard it looks like this:
![UIButton with linked IBAction](https://i.stack.imgur.com/H5gDI.png)
![Modal Segue with Custom Identifier](https://i.stack.imgur.com/sZSfh.png)
Then in my code, I do this:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSLog(@"Vimeo Segue");
if([segue.identifier isEqualToString:@"playVimeo"]) {
WebViewViewController *controller = (WebViewViewController *)segue.destinationViewController;
controller.vimeoURL = vimeoURL;
}
}
- (IBAction)launchCreativeFuture:(id)sender {
vimeoURL = @"72053500";
[self performSegueWithIdentifier:@"playVimeo" sender:sender];
}
This works, and I'm happy with this. However...
I stumbled across another way of doing this, and I'm confused as to why they both work, and which one is recommended.
Here, I've added a linked IBAction and a modal segue, as per these pictures:
![linked IBAction](https://i.stack.imgur.com/SHd3h.png)
![modal segue identifier](https://i.stack.imgur.com/9G38n.png)
And my code looks like this:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([segue.identifier isEqualToString:@"pushToGraduateCourses"]) {
NSLog(@"Grad Segue");
UIViewController *controller = (UIViewController *)segue.destinationViewController;
}
}
- (IBAction)launchGraduate:(id)sender {
NSLog(@"Grad Button");
[self performSegueWithIdentifier:@"pushToGraduateCourses" sender:sender];
}
Pretty identical code-wise, as far as I can tell... except that when I do this, I get a warning: "Warning: Attempt to present on while a presentation is in progress!" ... when I look at my console, the "Grad Segue" is logged twice... which makes sense, but in my first example, "Vimeo Segue" is only ever logged once.
I guess what I am asking is a few questions:
a) can anyone spot the difference between the two methods? Because I can't.
b) does creating a segue from Interface Builder automatically call performSegueWithIdentifier from the button without having to programatically call that from the IBAction that is linked to that button ?
c) which way is recommended ?
Thanks in advance,
~ Jesse