Hello to all HashCode users! I again have a question on iOS development, please tell me how to call a modal controller by pressing a button, and then remove it. I get to call (dragged from the button to the controller and chose "Modal"). Everything seems to be opening, but I can't hide it, help please :)
2 answers
[self dismissViewControllerAnimated: YES completion: nil]; This function must be called in the modal controller method, for example, when you press the Back button, or some other method that should return the user to the previous screen.
- Could you give a more detailed answer? - AlexDenisov
- Thank you very much, everything worked :) - leonid
- one@AlexDenisov that requires further clarification? I will try to answer - zhenyab
- 2@ Kovalsky, I know, cap. With such questions, as a rule, newcomers come, and it was nice to give a more detailed and polite answer. - AlexDenisov
- 2@AlexDenisov, In this question I completely agree with you :) - Zarochintsev
|
Transitions can be done without the "webs". To do this, create a button and write in the implementation:
UIStoryboard* storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; view2ViewController *destViewController = [storyBoard instantiateViewControllerWithIdentifier:@"view2"]; [self presentViewController:destViewController animated:YES completion:nil]; Where view2ViewController is the controller to which you want to go @ "view2" - Storyboard ID of the Controller
To go back you need to create a button and register a small piece of code, like this:
- (IBAction)back:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; } |