Split View Controller is not a Root View Controller

I have an application that requires a LOG IN user. When the user is logged in, I want to use the Split View Controller to display the data. The trick is that Apple doesn't want me to click on the SplitViewController , since they want it to be the Root View controller. From my point of view, everything is in order, but I need to log in first.

Does anyone know a workaround other than creating my own SplitViewController -like VC?

+4
source share
4 answers

You can still change the root view controller if you need to. Initially, you can install the root view controller to display the login screen, and then replace it with the split view controller. Alternatively, you can present your login screen on top of the split view controller.

0
source
 UISplitViewController *svc = (UISplitViewController*)[self.storyboard instantiateViewControllerWithIdentifier:@"SplitView"]; [self presentModalViewController:svc animated:YES]; 

Assuming you are using storyboards, and gave the controller a split view identifier (SplitView)

+1
source

You can always add a dummy viewController and click the splitView controller on the dummyView Controller, and then click the DummyView Controller on top of your current view controller, for example.

 AppDelegate *appdelegate = (AppDelegate*)[UIApplication sharedApplication].delegate; self.splitViewController = [[[UISplitViewController alloc] init] autorelease]; self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController]; self.splitViewController.delegate = detailViewController; UIViewController *dummyView = [[UIViewController alloc]init]; [dummyView.view addSubview:self.splitViewController.view]; [appdelegate.rootNavigationController setNavigationBarHidden:YES animated:NO]; [appdelegate.rootNavigationController pushViewController:dummyView animated:YES]; 
+1
source

This helped me (via Xamarin):

 public override bool ShouldPerformSegue (string segueIdentifier, NSObject sender) { if (segueIdentifier != ReportSettingsSegue) return base.ShouldPerformSegue (segueIdentifier, sender); bool isOk = ProcessLogin (); var svc = (ReportSplitViewController)Storyboard.InstantiateViewController ("ReportSplitViewController"); View.Window.RootViewController = svc; return isOk; } 

Segue to execute after pressing the "enter" button on the first screen of the application.

You should also set the identifier of the split controller identifier (storyboard identifier) ​​in the identification inspector in the storyboard (for me, this is ReportSplitViewController)

+1
source

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


All Articles