我正在使用childView控制器通过按钮在导航栏上显示一组选项/变种,当我点击按钮时,会出现子视图并在同一个按钮上单击我要删除子视图。 Plz帮助提前谢谢。
这是代码
UIViewController * topViewController = navigationControllerGlobal.topViewController;
childViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil]instantiateViewControllerWithIdentifier:@"childViewStoryboardId"];
self.myParentViewController = topViewController;
[topViewController addChildViewController:childViewController] childViewController.view.frame= self.myParentViewController.view.frame ;
[topViewController.view addSubview:childViewController.view];
[childViewController didMoveToParentViewController:topViewController];
答案 0 :(得分:0)
这里是答案的人,
[[NSNotificationCenter defaultCenter] postNotificationName:@"removeChildNotify" object:navigationControllerGlobal.topViewController]