Xcode 接收到内存警告情节提要

Xcode 接收到内存警告情节提要,xcode,uiviewcontroller,storyboard,didreceivememorywarning,Xcode,Uiviewcontroller,Storyboard,Didreceivememorywarning,我已经创建了一个视图控制器,它在viewDidLoad函数中包含以下代码: [self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View1"]]; [self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View2"]]; [self addChildVi

我已经创建了一个视图控制器,它在
viewDidLoad
函数中包含以下代码:

[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View1"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View2"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View3"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View4"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View5"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View6"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View7"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View8"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View9"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View10"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View11"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View12"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View13"]];
[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"View14"]];
打开新的ViewController并返回初始ViewController时,使用以下代码:

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"Home"];
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:vc animated:YES completion:NULL];

我收到了记忆警告

您不是返回主视图控制器,而是创建主视图控制器的新实例并演示它。如果这样做的次数足够多,那么最终会出现大量控制器和内存不足的情况


试着放弃你的控制器,尽管你的问题并不是很清楚你是如何进入包含所有子控制器的VC的

如何解除控制器?
dismissViewControllerAnimated:completion:
“演示视图控制器负责解除它所演示的视图控制器。如果对演示视图控制器本身调用此方法,它会自动将消息转发给演示视图控制器。“我如何终止?”[self-addChildViewController:[self.storyboard InstanceEviewController WithiIdentifier:@“View1”]];“我已在ViewDidLoad中实例化了它?假设您使用的是ARC,则不需要这样做。解除父视图控制器时,它将清除其所有子视图。