我正在使用 UIStoryBoard 来允许 FirstViewController 将第二个 ViewController 的视图添加为子视图。使用以下方法删除子视图
第一视图控制器.m
- (IBAction) btnMoveTo:(id)sender
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"Second"];
vc.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:vc animated:NO];
}
第二视图控制器.m
-(void)viewDidLoad{
self.view.opaque = YES;
self.view.backgroundColor = [UIColor clearColor];
}
- (IBAction) withDraw:(id)sender{
[self.view removeWithZoomOutAnimation:2 option:nil];
}
当我访问 withDraw 函数时,SecondViewController 的视图被删除并且 firstViewController 又回来了。但是,当我使用按钮访问 - (IBAction) btnMoveTo:(id)sender 函数时。它不起作用。什么都没有发生。任何建议或帮助将不胜感激。