How to navigate back from UISplitViewController IOS 5?

I have 6 views in which I am placing the UISplitViewController at 4th position (i.e.the 4th view). Now when I navigate from 3rd view to 4th view (i.e. ViewController to SplitView) I want to come back to 4th view to 3rd view (i.e. SplitView to ViewController).

I am using the below code to show the UISplitViewController when I am navigating from 3rd view to 4th view.

MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
            UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];

            DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
            UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];

            masterViewController.detailViewController = detailViewController;
            self.splitViewController = [[UISplitViewController alloc] init];
            self.splitViewController.delegate = detailViewController;
            self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController, nil];
            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
            appDelegate.window.rootViewController = self.splitViewController;

Now I have created a toolbar in my navigation bar programmatically and placed a back button. Below is the code what I have tried to pop the view back to viewcontroller. (i.e. from SplitView to ViewController).

-(IBAction)backbtn:(UIBarButtonItem *)sender
{
//    RepresentativeAccount<UISplitViewControllerDelegate> *represent = [[RepresentativeAccount alloc]initWithNibName:@"RepresentativeAccount" bundle:nil];
//    //[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:2] animated:YES];
//    [[self.splitViewController.viewControllers objectAtIndex:0]popToViewController:represent animated:YES];
}

Please help thanks.

Answers


Reference: View Controller Catalog for iOS

A split view controller must always be the root of any interface you create.

In other words, you must always install the view from a UISplitViewController object as the root view of your application’s window.

The panes of your split view interface may then contain navigation controllers, tab bar controllers, or any other type of view controller you need to implement your interface.

Split view controllers cannot be presented modally.

So, what you are attempting is incorrect, and in fact your app may get rejected by Apple.


Need Your Help

Using AJAX in rails

jquery ruby-on-rails ajax search

I'm finished with doing a search application in Ruby on rails. But now I need to use AJAX into to it, so that the search action doesn't reload a new page.This is application.js file:

Delphi History - Source Control

delphi version-control

After reading some posts here on the advantages of using source control for a single developer, it seems to me that the main advantage is that I will have backups of all changes to the source files.