3

縦画面の下部にadmob「スマートバナー」を追加したい。しかし、コードは画面の上部に追加を表示します。これが私のコードです

    cocos2d::CCSize size = cocos2d::CCDirector::sharedDirector()->getWinSize();
            CGPoint origin = CGPointMake(size.width,0.0);
    bannerView_ = [[[GADBannerView alloc]
                      initWithAdSize:kGADAdSizeSmartBannerPortrait
                      origin:origin] autorelease];

原点をどのように変更しても、広告は画面の上部に表示されます。どんな助けも非常に高く評価されています。ありがとう

4

2 に答える 2

2

これが、画面の下部に広告を表示する方法です。

    GADBannerView* bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];

//For Positioning
    float winHeight = viewController.view.frame.size.height;
    float winWidth = viewController.view.frame.size.width;
    //BannerView y-center is half of it's total height, and co-ordinates have to be calculated with TOP-Left as (0,0). Multiplied by 0.5 for y-center of banner view.
    bannerView_.center=CGPointMake(winWidth/2, winHeight - 0.50 * bannerView_.frame.size.height);

    //bannerView_.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;

    // Let the runtime know which UIViewController to restore after taking
    // the user wherever the ad goes and add it to the view hierarchy.
    bannerView_.rootViewController = viewController;
    [viewController.view addSubview:bannerView_];




GADRequest * request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:
                       GAD_SIMULATOR_ID,                               // Simulator
                       nil];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
于 2014-02-10T10:53:30.100 に答える