Push uiviewcontroller from currentModalViewController

I Display the view with presentModalViewController. and from this UIViewI want to click UIViewusing UINavigationController. I tried under the code for this

[self.parentViewController.navigationController 
                pushViewController:objViewFullScreen 
                          animated:YES];

But that did not work for me. so please anyone can suggest how I click the view from ModelViewController.

thank

+5
source share
2 answers

First you must present your modal view controller inside the navigation controller:

MyViewController *vc = [[MyViewController alloc] initWithNibName:@"MyNib" bundle:nil];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];

[self presentModalViewController:nc animated:YES];

[vc release];
[nc release];

Then inside MyViewControlleryou can do:

OtherViewController *vc = [[OtherViewController alloc] initWithNibName:@"MyOtherNib" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
+8
source
-(void)pushViewControllerWithCustomAnimation:(UIViewController *)newViewController {
    newViewController.view.alpha = 0.0f;
    [self.view addSubview:newViewController.view];

    [UIView animateWithDuration:1
                     animations:^{
                         newViewController.view.alpha = 1;
                     }
                     completion:^(BOOL fin){
                         if (fin) {
                             // finally display the new viewcontroller for real
                             [self.navigationController pushViewController:newViewController animated:NO];
                         }
                     }];
}
0
source

All Articles