Hello! I collect the program on a third-party engine. Xcode and obj-c don't know at all. Tell me, please, how to solve the problem with the creation of species.

The XIB has a Window without a custom class, a ViewController with a RunnerViewController class, and a View with an EAGLView class (inside the ViewController). There is a g_glView link to this view. There is no access to the ViewController class. All * .m files are hidden in. * A library. Task: show third-party banner. If I show it inside g_glView, then the application crashes. Probably, the banner does not support rendering with OpenGL.

extern *UIView g_glView. [theInterstitiel show:g_glView]; //crash 

If I programmatically add my View, via rootViewController, then exactly the same thing happens. I guess rootViewController is the controller with the class RunnerViewController. And my view is added to the view EAGLView, which draws in OpenGL.

 static UIView *promoview; static UIViewController *promocont; promoview = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; promocont = [UIApplication sharedApplication].keyWindow.rootViewController; [promocont.view addSubview: promoview]; [theInterstitiel show:promoview]; //crash 

However, if I add my view to the Window, the application does not crash.

 static UIView *promoview; promoview = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIWindow* promowindow = [[UIApplication sharedApplication] keyWindow]; [promowindow addSubview: promoview]; [theInterstitiel show:promoview]; 

But at the same time, my view is above all the others and when I click on the banner, the AppStore window appears behind it and is not visible.

Question: Is it possible to add your view not as SubView of the main view of EAGLView, but next to it, but so that it is higher than the main view of EAGLView?

    1 answer 1

    next to can not add, twist must be either higher or lower (by z order) neighboring twist. Try to just hide your view after the click. Plus look at the very reason for the crash. Perhaps there is another reason