2

I'm having a problem with input in libGDX in the iOS backend. It happens when I have Mopub banner ads displayed. When I put my first finger on the screen, I get a touchDown event (pointer = 0) and when it comes to my second finger, nothing is triggered. BUT for some reason it works when I put my second finger near the banner area (I think it's the banner's frame that I'm hitting). When banner ads aren't displayed, everything works fine. Also everything works fine on Android.

I'd really appreciate the help to tackle this problem here.

Thanks in advance.

  • iOS 8.3;
  • roboVM 1.2.0;
  • gdx 1.6.0;

Here's how I load the Banner:

    UIApplication application;

    String id;

    BANNER_SIZE = MPConstants.MOPUB_BANNER_SIZE;
    id = BANNER_ID;

    rootViewController = application.getKeyWindow().getRootViewController();

    banner = new MPAdView(id, BANNER_SIZE);
    double bannerWidth = UIScreen.getMainScreen().getBounds().getWidth();
    double bannerHeight = bannerWidth / BANNER_SIZE.getWidth() * BANNER_SIZE.getHeight();

            banner.setFrame(new CGRect((UIScreen.getMainScreen().getBounds().getWidth() / 2d) - (BANNER_SIZE.getWidth() * .5d), 0, bannerWidth, bannerHeight));
    adViewController = new MPAdViewController(banner);

    MPAdViewDelegate bannerDelegate = new MPAdViewDelegateAdapter(){
        @Override
        public UIViewController getViewController() {
            return adViewController;
        }
    };

    banner.setDelegate(bannerDelegate);
    adViewController.getView().addSubview(banner);
    rootViewController.getView().addSubview(adViewController.getView());


    if(!isBannerLoaded) {
        banner.loadAd();
        isBannerLoaded = true;
    }

Here's my didFinishLaunching method:

@Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
    super.didFinishLaunching(application, launchOptions);
    //The 0 doesn't do anything. It was something I was trying out.
    adController.loadBanner(application, 0);


    rootViewController = application.getKeyWindow().getRootViewController();
    application.getKeyWindow().setRootViewController(rootViewController);
    application.getKeyWindow().addSubview(rootViewController.getView());

    application.getKeyWindow().makeKeyAndVisible();


    return false;
}
jos_fzr
  • 188
  • 2
  • 10

1 Answers1

0

You should add this line to your adViewController

adViewController.getView().setMultipleTouchEnabled(true);
ASM
  • 363
  • 1
  • 2
  • 14