I am working on an iOS application where I have two separate buttons that call, and display a UIViewController from an .xib file. When this viewController is displayed for the user, the user enters data, and then dismisses the viewController, and is taken back to the main application where he/she originally came from.
My problem is that this viewController that is called, and then dismissed by the user is activated by two different buttons, and the data that is entered by the user has to be kept track based on which button calls it. However, in creating and calling the viewController, I don't know how to pass the tag value from the buttons which would distinguish which button is calling it.
Here is my code which creates and calls the viewController from the .xib file (and is called by both buttons):
- (IBAction)buttonClicked:(id)sender {
_nextView = [[NextViewController alloc] initWithNibName:@"NextViewController" bundle:nil];
[_nextView setDelegate:(id)self];
NextNavigationController *navigationController = [[NextNavigationController alloc] initWithRootViewController:_nextView];
[self presentViewController:navigationController animated:YES completion:nil];
}
This code works fine in calling the viewController, but I also need to pass with it the tag value from the button which calls this method. How can I do this?