Note that there are some explanatory texts on larger screens.

plurals
  1. PONavigationController is not popping the Pushed View on Back button
    primarykey
    data
    text
    <p>Having a simple Navigation Controller in place (starting the Navigation Based Application project) I created a new View with a XIB file.</p> <p>on my <code>HomeViewController</code> (Home screen with all options as <code>UIButton</code>'s I have:</p> <pre><code>@implementation HomeViewController -(IBAction) optionChoosed:(UIButton *)button { NSString *msg = [NSString stringWithFormat:@"Button: %d", button.tag]; UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Hi" message:msg delegate:nil cancelButtonTitle:@"Go away" otherButtonTitles:nil]; switch (button.tag) { case 13: // Simple Search [self loadSimpleSearch]; break; default: [alert show]; break; } [alert release]; } -(void)loadSimpleSearch { SimpleSearchViewController *controller = [[SimpleSearchViewController alloc] initWithNibName:@"SimpleSearchViewController" bundle:nil]; [self.navigationController pushViewController:controller animated:YES]; [controller release]; } </code></pre> <p>witch works great!</p> <p>it Pushes the View into the front of the stack!</p> <p>Now, because in my 2nd view <code>SimpleSearchViewController</code> I have <code>self.title = @"myTitle";</code> I get the Title in the NavigationBar as well the back button (as I have the same setting on the <code>HomeViewController</code>)</p> <p>I thought that the NavigationViewController would handle the pop of the current view, but it does not.</p> <blockquote> <p><strong>What do I have to do</strong>, to pop the <code>SimpleSearchViewController</code>?</p> <p><strong>Where do I use</strong> <code>[self.navigationController popViewControllerAnimated:YES];</code></p> </blockquote> <p>as the view continues there, and <code>ViewDidUnload</code> is never called. </p> <p>My idea was that this should be handle in the first ViewController, the <code>HomeViewController</code> but I have no idea what is the method I should hook to, and I read the documentation and I can't figure it out :-/</p> <p>Any help is greatly appreciated, <strong>thank you</strong>.</p> <p><code>HomeViewController</code></p> <p><a href="http://cl.ly/XNS/Screen_shot_2010-04-21_at_22.38.51.png" rel="nofollow noreferrer">alt text http://cl.ly/XNS/Screen_shot_2010-04-21_at_22.38.51.png</a></p> <p><code>SimpleSearchViewController</code></p> <p><a href="http://cl.ly/YDw/Screen_shot_2010-04-21_at_22.40.00.png" rel="nofollow noreferrer">alt text http://cl.ly/YDw/Screen_shot_2010-04-21_at_22.40.00.png</a></p> <p><code>SimpleSearchViewController</code> after pressing the <em>Back</em> button</p> <p><a href="http://cl.ly/XLO/Screen_shot_2010-04-21_at_22.40.21.png" rel="nofollow noreferrer">alt text http://cl.ly/XLO/Screen_shot_2010-04-21_at_22.40.21.png</a></p> <hr> <p>To add the image from a comment that asks if HomeViewController as the root controller for the NavigationViewController</p> <p><img src="https://i.stack.imgur.com/zVOeb.png" alt="alt text"></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.
 

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