Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>by Kaspar answer, here is my code in Obj-C.</p> <p>.h:</p> <pre><code>@interface ProperNavigationController : UINavigationController @end @interface ProperNavigationControllerDelegate : NSObject &lt;UINavigationControllerDelegate&gt; @property (assign, nonatomic) BOOL wasCalled; @end </code></pre> <p>.m:</p> <pre><code>#import "ProperNavigationController.h" @interface ProperNavigationController () @property (strong, nonatomic) id&lt;UINavigationControllerDelegate&gt; oldDelegate; @property (strong, nonatomic) ProperNavigationControllerDelegate *myDelegate; @end @implementation ProperNavigationController @synthesize oldDelegate = _oldDelegate; @synthesize myDelegate = _myDelegate; - (void)viewDidLoad { [super viewDidLoad]; self.oldDelegate = self.delegate; self.myDelegate = [ProperNavigationControllerDelegate new]; self.delegate = self.myDelegate; } - (UIViewController *)popViewControllerAnimated:(BOOL)animated { self.myDelegate.wasCalled = FALSE; UIViewController *vc = [super popViewControllerAnimated:animated]; if (!self.myDelegate.wasCalled) { // if iOS did not call the delegate handler then we must do it [self.myDelegate navigationController:self willShowViewController:self.topViewController animated:animated]; [self.myDelegate navigationController:self didShowViewController:self.topViewController animated:animated]; } return vc; } @end @implementation ProperNavigationControllerDelegate @synthesize wasCalled = _wasCalled; // flag that we use to track whether iOS calls the handlers or we have to - (id)init { if (self = [super init]) { _wasCalled = FALSE; } return self; } - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { ProperNavigationController *nc = (ProperNavigationController *)navigationController; [nc.oldDelegate navigationController:navigationController willShowViewController:viewController animated:animated]; self.wasCalled = TRUE; // signal that we have been called } - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { ProperNavigationController *nc = (ProperNavigationController *)navigationController; [nc.oldDelegate navigationController:navigationController didShowViewController:viewController animated:animated]; } @end </code></pre> <p>it work.</p> <p>What do you think ? And should we fill a bug report ?</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