Hello. I have one Storyboard in which there are two screens, for each screen I have separate ViewController classes. I want to make it so that when I press the button on the first screen, the second one is shown. Nowhere can I find the desired function to change the screen. Help me please.

    3 answers 3

    Well, look, maybe this will help.

    • Yes, thanks more, that's what I need. - Ya Kudinov

    Just throw a link from the button to the second view, that's all (pre-navigate the controller accordingly.)

    Well, respectively, delegates and KVM desirable to know :)

    As far as I remember directly using methods from another class is possible only with the help of delegates like this: Example for delegate

    And transfer data using KVO , like this: Objective-C binders

      You can specify the button for example such a method

       - (void)showNewController { UINavigationController *contactNavController = [self.storyboard instantiateViewControllerWithIdentifier:@"StoryBoardID"]; ContactsViewController *vc =(ContactsViewController*)contactNavController.topViewController; [self presentViewController:contactNavController animated:YES completion:Nil]; } 

      do not forget the window that is called to set StoryBoard Id