简体   繁体   中英

How to add a login view before a UISplitViewController iPad

I would like to show a login view before a UISplitViewController in my app. I am not sure how to do that as Apple docs regarding iPad says that UISplitViewController should be a root view controller of the app.

Use a modal view controller to present the login view. You could either do a full-screen view that is presented without animation, or (how I would do it) a form style view that allows the split view controller to be seen but not interacted with.

Hey just use popup screen with login and password . By using this u can still hold apple documents right to use .I did the same with my app. Becz there is no legal way of adding other than split view as root view controller.

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Login"
                                                    message:@"Enter username and password"
                                                   delegate:self
                                          cancelButtonTitle:nil
                                          otherButtonTitles:@"Login", nil];

alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
alertView.tag = AlertOne;
[alertView show];

-(void)applicationDidBecomeActive:(UIApplication *)application call this popup in above delegate method in appdelegate file . It works like charm .

Do it in app delegate. Before adding splitviewcontroller.view to your window. You add your login view and after you have successfully logged in remove this logine view and add the splitviewcontroller.view

You can load your login viewcontroller in main window first. after successfull authentication remove the view controller from the window using

[[[[UIAppDelegate window ] subviews] objectAtIndex:0] removeFromSuperview];

Add your splitview to the window. if you again want to show login, remove the splitivew using the same piece of code and show the login page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM