我的项目使用 ARC,所以我不能使用保留或释放,在 ViewController A 中,我初始化 ViewController B 并将其视图添加为子视图:
ViewControllerB *viewB = [[ViewControllerB alloc] init];
[self.view addSubview:viewB.view];
在 ViewControllerB 中,我制作了一个按钮,当用户单击它时,该视图将从超级视图中删除:
[self.view removeFromSuperview];
结果是 EXC_BAD_ACCESS。请帮助我并对我的英语感到抱歉。