How can I close UIVIewController?

JAEP picture JAEP · Feb 14, 2011 · Viewed 9.1k times · Source

I have a MainWindowController that I want to close on "touch inside" button event and open a new UIView. The code that I use is this:

NewViewController *controller = [[NewViewController alloc]
initWithNibName:@"NewView" bundle:nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];
[controller release];

But in this way the MainWindowController don't close it self.

Answer

MahboobiOSDeveloper picture MahboobiOSDeveloper · Apr 16, 2014

Try this one

[self dismissViewControllerAnimated:YES completion:nil];