How to click from the view controller to the navigation view controller using the prepareForSegue method?

I have a project that has a view controller as a start screen, and then a view controller built into the navigation view controller. I also have a button on the first screen, the click of which I want to open the screen of the navigation controller.

I clicked on the button and then on the “connection inspector”, I added a push event for this navigation controller, but segue does not happen. How can I achieve this, please?

DECISION

Finally, after a little research, I managed to get this work to work. Here is the code I'm using:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"Source Controller = %@", [segue sourceViewController]);
    NSLog(@"Destination Controller = %@", [segue destinationViewController]);
    NSLog(@"Segue Identifier = %@", [segue identifier]);

    if ([segue.identifier isEqualToString:@"mysegue"])
    {
        NSLog(@"coming here");

     SecondViewController *loginViewController = (SecondViewController *)segue.destinationViewController;

       //SecondViewController *navigationController = [[UINavigationController alloc]init];

        [self presentModalViewController:loginViewController animated:YES];


    }

}
+3
source share
1

, ? Push, Relationship.

, Apple , , : iOS. prepareForSegue segue; segue .

0

All Articles