In your SearchView.h add the line @property (nonatomic) int tag
.
Then in View1.m add the following method:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"searchSegue1"])
[segue.destinationViewController setValue:1 forKey:@"tag"];
}
Do the same thing in View2.m but replace 1 with 2. Then change your if statement to:
if (self.tag == 1)
[self performSegueWithIdentifier:@"unwindToSegue1"];
else if (self.tag == 2)
[self performSegueWithIdentifier:@"unwindToSegue2"];