Search code examples
xcodeloadview

Loading/dismissing a Progmatically (non-xib) View via UIButton


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 views...am 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.


Solution

  • Is it a uiView or uiviewController??? if it is a UIView controller all you have to do after doing what you need on the view controller yse the code: [self.navigationController popViewControllerAnimated:YES]; if you want an animated return or [self.navigationController popViewControllerAnimated:NO]; for a "dry" return...