How can you use sender in performSegueWithIdentifier function?
2 answers
If you want the destination view dispatcher to receive the sender in the segment, you will need to send a message to destinationViewController from the method prepareForSegue
.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"MySegue"]) {
MyViewController *destinationViewController = (MyViewController *)segue.destinationViewController;
destinationViewController.sender = sender;
}
}
This question is very similar.
+3
source to share