Resolved Loading a Progmatically created view Controller

Discussion in 'iOS Programming' started by LastLine, Apr 27, 2011.

  1. LastLine, Apr 27, 2011
    Last edited: Apr 27, 2011

    LastLine macrumors 65816

    Aug 24, 2005
    Hey all - last dumb question (I hope)

    I've got a situation whereby the following happens.

    Progmatically created view (because it's easiest for what I'm doing)
    User taps button, Xib based view appears using following code to load the Xib based view (InfoView2)

        InfoView2 *infoView2 = [[InfoView2 alloc] initWithNibName:@"InfoView2" bundle:nil];	
            [self.navigationController pushViewController:infoView2 animated:YES];
            [infoView2 release];
    Now, I want to remove InfoView2 and go back to TapView, the progmatically created view - I feel this should be relatively simple, but every guide and tutorial I can find shows how to load Xib based views, I can't find one for non-Xib based I being thick? Am I loading InfoView2 in the wrong way to start with?

    I should note this is for an iPhone app - for the iPad side of the app I load InfoView2 in a popoverViewController as it's essentially the settings for the app.

    Anyone able to offer some insight?

    Honestly...last daft post...I promise. Small words please ;) 12 hour day coming to an end.
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    This is the usual way to remove the topmost view controller.

    [self.navigationController popViewControllerAnimated:YES];
  3. LastLine thread starter macrumors 65816

    Aug 24, 2005
    Doh...I was trying modalViewController....thank you.
  4. Shawnpk macrumors 6502

    Jan 13, 2011
    Los Angeles, CA
    Use pushViewController to add the view and popViewController to remove the view.

Share This Page