user658202
user658202

Reputation: 11

UIViewController Release in iphone

I am Using 5 pages in my project.. Here i can navigate pages 1 to 5 one by one using presentModelViewController.. How to release in between pages such as 2,3,4 when i navigate from page 5 to page 1..

Thanks..

Upvotes: 1

Views: 146

Answers (2)

Prabh
Prabh

Reputation: 2474

To pop directly to root view controller use:

    [self.navigationController popToRootViewControllerAnimated:YES];

In order to pop back to a specific controller use this code:

    NSArray *viewController = self.navigationController.viewControllers;
[self.navigationController popToViewController:[viewController objectAtIndex:1]  animated:YES];

Here objectAtIndex will be your required viewVController.

Hope this works for you.

Upvotes: 1

Kirby Todd
Kirby Todd

Reputation: 11556

Use pushViewController instead of presentModalViewController to push multiple views onto the nav controller stack. When you want to go back to the root call popToRootViewControllerAnimated and your UINavigationController will release all of the views that are no longer on the view stack.

Upvotes: 0

Related Questions