This project is read-only.

UIView on top of cocos2d-xna window

Topics: iOS
Mar 7, 2014 at 9:24 AM
How can you put a UIView on top of cocos?
I made it possible with a new UIWindow but then the cocos loses it touch registrations.
you must somehow create both views (UIView and cocoswindow) in the same UIWindow I think?

Anyone advice?
Mar 7, 2014 at 5:39 PM
You start with getting the root UI view and then attaching any other UI views atop of that view, as in the case of a popup interstitial ad.

You do that in your game class:

RootUIController = Services.GetService (typeof(UIViewController)) as UIViewController;

That should do it.
Mar 7, 2014 at 5:39 PM
BTW. This is also how you get the root UI controller to use Xamarin.Social to do Facebook integration on iOS.
Mar 10, 2014 at 8:24 AM
thank you very much.
it is indeed as simple as that!
Aug 11, 2014 at 9:19 PM
Any idea how to correctly integrate cocos2d-xna into an existing UINavigationController stack of UIViewControllers?

I have an existing app that pushes and pops UIViewControllers as the user navigates up and down through the UI. I have succeeded in getting a cocos2D-xna to show up when a given view is created, but have two problems:
  1. The cocos2D area covers the entire screen, hiding the iOS navigation top bar. Can the cocos2d drawing area be restricted so the navigation controller still shows up?
  2. How to shutdown/hide the cocos2D view when the user is ready to go back up the navigation stack. I have tried popping the view, but it just leaves the cocos2D area still visible. I have tried removing the running CCApplication from the Components list, setting the CCApplication.Enabled flag to false, and calling CCDirector.SharedDirector.End (), but none of those help.
Any ideas?
Aug 12, 2014 at 5:50 AM
On #1, the render screen is dictated by your preferred buffer size. For iOS, if you don't set the FullScreen option does it allow you to set the screen size to a smaller window? that would be purely a MonoGame feature.

On #2, you should be able to just hide the view controller that contains the cocos2d render window.