How to add an overlay to a UITabbarController

瘦欲@ 提交于 2019-12-25 05:15:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!