如果在viewWillAppear里写入[self->glView start];在viewWillDisappear里[self->glView stop];
则跳转另一个页面后,回来会白屏,只有重新再viewWillAppear初始化一下,
if (!self->glView) {
self->glView = [[OpenGLView alloc] initWithFrame:CGRectZero];
self.view = self->glView;
}
[self->glView setOrientation:UIInterfaceOrientationPortrait];
然后在viewWillDisappear里self->glView = nil;一下,才可以不会白屏,但是这样做的话,识别几次跳转几次界面回来后,就会崩溃在viewWillAppear里重建glView这里,
下面是崩溃信息
CloudRecognizerCallBack: Success
2018-02-09 11:07:24.996074+0800 GolfMooc[2695:2406999] load target (false): P109-2.png (16)
libc++abi.dylib: terminating
一直捕获不到哪里错了,然后我在viewWillAppear写了打印语句,发现崩溃的时候第一句打印了,第二句没打印,证明崩溃zazai 初始化glview这里。希望有知道的大佬,能帮帮我解惑。非常感谢
NSLog(@"%s\n%@", __FUNCTION__, NSStringFromClass([self class]));
[super viewWillAppear:animated];
[self initGL];
[self->glView start];
NSLog(@"测试打开ar%s\n%@", __FUNCTION__, NSStringFromClass([self class]));