- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.blueViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Blue"]; [self.view insertSubview:self.blueViewController.view atIndex:0]; }
内存不足处理
代码示例:
1 2 3 4 5 6 7 8 9
- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. if (!self.blueViewController.view.superview) { self.blueViewController = nil; } else { self.yellowViewController = nil; } }