[英]How do I add a UIViewController?
I have a GLES game, it has no standard UI elements. 我有一个GLES游戏,它没有标准的UI元素。 It is based on the code from GLSprite which contains a UIView and an AppDelegate (full source code on github https://github.com/acekiller/iOS-Samples/tree/master/GLSprite/Classes )
它基于GLSprite的代码,其中包含UIView和AppDelegate(完整的源代码在github https://github.com/acekiller/iOS-Samples/tree/master/GLSprite/Classes上 )
The problem I have is I want to add GameCenter functionality and need to open the matchmaking views, but they require I pass a UIViewController to them, of which I have none! 我的问题是我想添加GameCenter功能并需要打开配对视图,但是它们要求我将UIViewController传递给它们,而我却没有!
Can I add a UIViewController to my current game (which I would really love to do as I have modified the GLSprite source somewhat and don't want to mess around with getting new code working) and how do I add it? 我可以在当前游戏中添加一个UIViewController(我真的很想做,因为我已经修改了GLSprite源代码,并且不想弄乱新代码的工作),如何添加它?
Thank you for your help. 谢谢您的帮助。
Simply add this to the end of applicationDidFinishLaunching 只需将其添加到applicationDidFinishLaunching的末尾
UIViewController *vc = [[UIViewController alloc] init];
vc.view = glView;
self.window.rootViewController = vc;
[window makeKeyAndVisible];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.