cocos调用sdk在ios8上opengl卡死问题

前端之家收集整理的这篇文章主要介绍了cocos调用sdk在ios8上opengl卡死问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在cocos里面调用sdk页面时,如果在ios8.0上,切换sdk和cocos页面可能会引起opengl卡死,问题截图如下:



解决办法:

参考,里面的3.1有提示

在RootViewController里面添加如下语句,用于在切换时停止cocos特效

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 9.0)
    {
        cocos2d::Director::getInstance()->stopAnimation();
    }
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 9.0)
    {
        cocos2d::Director::getInstance()->startAnimation();
    }
}

猜你在找的Cocos2d-x相关文章