EXC_BAD_ACCESS EXC_I386_GPFLT while click on button

落爺英雄遲暮 提交于 2019-12-01 08:56:26

The noKids controller is going out of scope and being deallocated. This is what is often referred to as a zombie object.

You need to add the noKids controller to the childViewControllers of the containing controller.

NoKidsViewController *noKids = [self.storyboard instantiateViewControllerWithIdentifier:@"NoKidsView"];
[self addChildViewController:noKids];
[self.view addSubview:noKids.view];
[noKids didMoveToParentViewController:self];

This will retain the NoKidsViewController as well as allow the view controller methods to pass down to it. For more information on creating your custom container view controller:

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

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