There are 2 ways to pass your data from First screen to 2nd screen.
1st Way:
You can pass your data by creating VC object and assign value in it and push to next screen like below example.
Code :
//Initilize view controller from storyboard id.
ViewController *objViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
//Assign value
objViewController.presentButtonTag=sender.tag;
self.fromSkip=YES;
objViewController.skip=self.fromSkip;
//Push view
[self.navigationController pushViewController:objViewController animated:YES];
2nd Way:
By Storyboard you can set segue action on button and in prepare segue method you need to pass your data like this.
Code:
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if ([segue.identifier isEqualToString:@"ViewController"]) {
ViewController *objViewController = (ViewController*)segue.destinationViewController;
objViewController.selectedTag = ((UIButton*) sender).tag;
//Assign value
objViewController.presentButtonTag=sender.tag;
self.fromSkip=YES;
objViewController.skip=self.fromSkip;
}
}
Now you can check your scenario in both condition I think you are pushing to next screen by storyboard so use 2nd Way
.
Let me know if you need more help.