在显示横幅广告时,多点触控无法在iOS上使用robovm和libGDX

时间:2015-05-13 22:25:10

标签: ios input libgdx robovm mopub

我在iOS后端的libGDX输入有问题。当我显示Mopub横幅广告时会发生这种情况。当我把第一根手指放在屏幕上时,我得到一个touchDown事件(指针= 0),当它到达我的第二根手指时,什么都没有被触发。但是出于某种原因,当我将第二根手指放在横幅区域附近时(我认为这是我正在击中的横幅框架),它可以工作。如果没有展示横幅广告,一切正常。 Android上一切正常。

我非常感谢帮助解决这个问题。

提前致谢。

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

以下是我加载横幅的方式:

    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;
    }

这是我的didFinishLaunching方法:

@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;
}

1 个答案:

答案 0 :(得分:0)

您应该将此行添加到您的adViewController

adViewController.getView().setMultipleTouchEnabled(true);