How to correctly display a new view and how to return to the previous view

I am very new to developing iPhone and Objective-C. Today I found out how to open a new ViewController and how to return to the previous one.

Here's how I do it now:

// In the main view controller, I have an openSecondView method, which is defined as follows:

- (void) openSecondView:(id)sender {
    SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:secondView animated:YES];
}

// In SecondViewController, I have a return button that calls the closeView method, which is defined as follows:

- (void)closeView:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

My question is: how do you do it right?

[release ] presentModalViewController - ? , , , , presentModalViewController, , , , , , , rejectModalViewControllerAnimated. - [release ] presentModalViewController?

/ .

+3
1

[release ] presentModalViewController. , .

+2

Source: https://habr.com/ru/post/1786237/


All Articles