In terms of programmatically transitioning to another scene in your storyboard, the general procedure is:
define a segue between the view controllers (not the button, but the view controllers);
give that segue a storyboard identifier;
create an IBAction
for a button that does the validation, and if successful, does a
[self performSegueWithIdentifier:@"myidentifier"];
See this answer on stack overflow in which I walked an individual through this process in some detail. If your case, it sounds like you're validating data, and might perform one segue given one series of conditions, and another segue in another series of conditions. So just give those two segues unique identifiers, and then you can perform whichever one your want in your IBAction
code.
In terms of passing data to that next scene, you do this in a separate method, prepareForSegue
, which iOS calls after the destination controller has been created, but before it's been presented. It's here that you have a chance to pass parameters to the destination controller. For example, I'm assuming that I captured the first and last name of an individual and want to pass that to the destination controller, which has first and last name properties:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"myidentifier"])
{
MyDestinationController *controller = segue.destinationViewController;
controller.firstName = self.labelFirstName.text;
controller.lastName = self.labelLastName.text;
}
}