I am switching views in the context of the navigation view hierarchy, and I want to be able to determine during the switchover that the previous view was pushed under a new view.
I am trying to do this in a UINavigationControllerDelegate:
(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { NSLog( @"Switching from %@ to %@", NSStringFromClass( [[navigationController visibleViewController] class] ), NSStringFromClass( [viewController class] ) ); }
I get this:
2009-08-05 20: 05: 21.274 Application Name [85913: 20b] Switching from ManagementScreen to ManagementScreen
Unfortunately, it looks like it was already unloaded in the UINavigationController state before the “will” call, so the passed viewController always matches the visible visualization control in the UINavigationController (as well as the topViewController attribute, which is not shown here but I tried it with the same code )
I would like to avoid expanding the navigation view controller and, frankly, while I can easily place the property on the deletion, but I wonder if this behavior is possible within the existing structure (it seems like it needs to be called before this happens where as it was after, but it looks like the state of the navigation controller is modified before either).
Thanks!
source share