Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS Delegate Does Not Push or Present a View
    primarykey
    data
    text
    <p>I have a HomeView and a HomeDropDownView.</p> <p>HomeDropDownView is shown as a drop-down view over the HomeView.</p> <p>HomeView is a delegate of HomeDropDownView.</p> <p>When I do an action in HomeDropDownView I want to call a delegate method in HomeView and have that delegate method present a third view controller, TestViewController from it's navigation controller.</p> <p>If I try to launch TestViewController from <em>anywhere</em> in the class it works fine - except from the delegate method.</p> <p>There are animations in HomeDropDownView but putting the call to the delegate method in the complition does not make the view controller appear. And in the case that I'm using this the animation's don't fire anyway; there's only a resizing without animation.</p> <p>TestViewController's init does get called as well as the viewDidLoad but not the viewWillAppear and the view dose not appear.</p> <p>Code:</p> <p>HomeDropDownView</p> <pre><code>- (void)finalAction { ... [self callDelegateAction]; ... - (void)calldelegateAction { if ([self.delegate respondsToSelector:@selector(launchTestView)] ) { [self.delegate launchTestView]; } else { DLog(@"Error out to the user."); } } </code></pre> <p>HomeView</p> <pre><code>- (void)launchTestView { //[self listSubviewsOfView:self.parentViewController.view]; NSLog(@"delegate method | self: %@", self); TestViewController *tvc = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil]; //[self.navigationController presentViewController:tvc animated:YES completion:nil]; //[self.view.window.rootViewController presentViewController:tvc animated:YES completion:nil]; //[self.navigationController pushViewController:tvc animated:YES]; AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; [appdelegate.tabBarController.navigationController presentViewController:tvc animated:YES completion:^() { NSLog(@"Done!"); }]; } </code></pre> <p>None of the above approaches work. But if I put the exact same code into the viewDidAppear or put it in a button action method, it will work fine. At the time of calling the delegate method's self is HomeView and all the subviews, including the nav controller do seem to be there. This is in a tabcontroller-based project but I think that any of the above are acceptable ways to call the nav controller still.</p> <p>What am I missing? Why does my delegate method not want to push/present a viewcontroller on HomeView's Nav controller? It's probably something I'm missing but I can't find a reason in the Apple Docs or any other thread. Thanks for the help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload