Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Currently the <code>UINavigationController</code> does not support this. But there's the <code>UINavigationControllerDelegate</code> that you can use.</p> <p>An easy way to accomplish this is by subclassing <code>UINavigationController</code> and adding a completion block property:</p> <pre><code>@interface PbNavigationController : UINavigationController &lt;UINavigationControllerDelegate&gt; @property (nonatomic,copy) dispatch_block_t completionBlock; @end @implementation PbNavigationController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { self.delegate = self; } return self; } - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { NSLog(@"didShowViewController:%@", viewController); if (self.completionBlock) { self.completionBlock(); self.completionBlock = nil; } } @end </code></pre> <p>Before pushing the new view controller you would have to set the completion block:</p> <pre><code>UIViewController *vc = ...; ((PbNavigationController *)self.navigationController).completionBlock = ^ { NSLog(@"COMPLETED"); }; [self.navigationController pushViewController:vc animated:YES]; </code></pre> <p>This new subclass can either be assigned in Interface Builder or be used programmatically like this:</p> <pre><code>PbNavigationController *nc = [[PbNavigationController alloc]initWithRootViewController:yourRootViewController]; </code></pre>
 

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