Best practice for displaying a modal view above the UISplitViewController

Creating a new application based on the SplitViewController template and it works fine in Split View mode.

My main screen is a menu without sharing. I am trying to find best practice for adding this "mainMenu" compared to splitViewController. (Then either click on other unsplit views over mainMenu or delete it to open and use the UISplitViewController.)

I tried:

[self.navigationController presentModalViewController:mainMenu animated:NO];

and

[self presentModalViewController:mainMenu animated:NO];

In the methods viewWillAppear and viewWillLoad for rootViewController and detailViewController. In both cases, the code is executed without errors, but mainMenu does not appear, the usual detailViewController and rootViewControllers elements appear.

( navigationController main.xib detailView, .)

, , , , .

iPad_Prototype_SplitAppDelegate *delegate = (iPad_Prototype_SplitAppDelegate *) [   [UIApplication sharedApplication] delegate];

[delegate.splitViewController.view addSubview:mainMenu.view];
[delegate.splitViewController.view bringSubviewToFront:mainMenu.view];

, , , splitViewController. .

, , detailViewController ?

+3
1

splitViewController AppDelegate ?

//AppDelegate.m
- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{  

MyController *myCont = [[MyController alloc] initMainMenu];
// mess around with myCont.view.modalPresentationStyle;

[myCont setModalDelegate:self]; 
// Create a delegate (<ModalControllerDelegate>) to dismiss view when done

[self.splitViewController presentModalViewController:myCont animated:NO];
[myCont release];
}

// for completion sake
-(void)modalViewDismiss:(MyController *)modalView {
    [self.splitViewController dismissModalViewController:YES];
}
+1

Source: https://habr.com/ru/post/1756020/


All Articles