Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The issue seems to be that I was subclassing UINavigationController to solve a different problem. When I remove this subclass, the issue goes away. That is, the "back" buttons are not messsed up anymore when I do popToRootViewController without subclassing UINavigationController. This, however, raises another problem. I was subclassing UINavigationController in order to solve the problem stated in <a href="https://stackoverflow.com/questions/6413595/uinavigationcontroller-and-uinavigationbardelegate-shouldpopitem-with-monotouc">UINavigationController and UINavigationBarDelegate.ShouldPopItem() with MonoTouch</a> </p> <p>With both my nav bar and my tab bar I want to be able to put up a message "Are you sure you want to Quit?" alert when the back button (or another tab) is pressed in the case when some data in the displayed view has changed (before navigating away from that view, and possibly canceling navigating away from that view). </p> <p>So, while this a partial answer, my problem still stands. I still need a means to gain control when the user types the back button or another tab. So, it seems I need: 1) A means to have a different delegate than the UINavigationController for UINavigationBarDelegate method shouldPopItem, or 2) Some means to subclass UINavigationController but not get the back button messed up as is currently happening when I click on a tab and call popToRootViewController.</p> <p>Further thoughts?</p> <p>More on 11/3/12</p> <p>It's not UINavigationController subclassing per se that was causing the issue. I was inadvertently returning NO from my delegate method </p> <pre><code>// This method returns true when the navigation bar should pop an item - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item { </code></pre> <p>when I did a popToRootViewController. I now have a method in my UINavigationController subclass:</p> <pre><code>- (void) popToRoot { regularPop = YES; [self popToRootViewControllerAnimated: YES]; } </code></pre> <p>that causes shouldPopItem to return YES, which I use instead of popToRootViewController. Most of my problems are solved!</p>
    singulars
    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