问题
Hi I have a UITabBarController
which i want to add on top an overlay containing a registration form.
I've seen several places that the way to go is to use this command:
[[[UIApplication sharedApplication] keyWindow] addSubview:registrationView];
But How can I create registrationView from the storyboard and be able to access it from the UITabBarController
?
Note: My registrationView should hide the tabs so i can't put it in one tab.
回答1:
Hey this will solve you issue
UITabBarController *tabBarController = (UITabBarController *) self.window.rootViewController;
ViewController *RegistrationView = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[tabBarController presentModalViewController:RegistrationView animated:YES];
[tabBarController.selectedViewController viewDidAppear:true];
do this in - (void)applicationDidBecomeActive:(UIApplication *)application
function
来源:https://stackoverflow.com/questions/12368986/how-to-add-an-overlay-to-a-uitabbarcontroller