1

I am trying to pass data from the current View Controller to the next View Controller using an IBAction because I also need to check if the user is using the correct User Email and ID before going to the second View Controller. I am still new to Objective-C and Xcode. I thought this would work but it doesn't. It will not pass the number 15 to the second VC. I would like to for it to be something like this. Please help me figure out a way to do this. This is actually for my Final Project that is due today. Lol

- (IBAction)signInButtonPressed:(id)sender {

    DatabaseManager *data = [DatabaseManager new]; // A DB Using SQLite3

    if (![self.studentEmailField.text isEqualToString:@""] && ![self.studentMDCID.text isEqualToString:@""]) {

        if ([data checkStudentEmail:self.studentEmailField.text checkStudentID:self.studentMDCID.text]) {

            StudentMainPageViewController *secoundVC = [StudentMainPageViewController new];

            secoundVC.rowInDB = 15;

            UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

            UIViewController *StudentMainPageVC = [mainStoryboard instantiateViewControllerWithIdentifier:@"StudentMainPageID"];

            [self presentViewController:StudentMainPageVC animated:TRUE completion:nil];
        }
    }
}
RoboChris
  • 387
  • 1
  • 5
  • 18

1 Answers1

1

Try use following solution:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{
    if ([segue.identifier isEqualToString:@"YourSegueIdentifier"]) 
    {
        DestinationViewController *dest = [segue destinationViewController];

        dest.myData = self.myData; 
    }
}
Evgeniy Kleban
  • 6,794
  • 13
  • 54
  • 107