iAd intetrstitial landscape未显示

时间:2016-01-04 11:23:21

标签: ios objective-c iad

我遇到屏幕方向问题iAd插页式广告。 当方向是poortrait它显示罚款。 但是当它改变为横向时,插页式广告没有显示,但是它被加载到是。

ADInterstitialAd *interstitial;
UIView *placeHolderView;
UIButton *closeButton;
UILabel *closeButtonLabel;

- (void) InitiAdInterstitial
{
    [self requestInterstitialAdPresentation];

    interstitial = [[ADInterstitialAd alloc] init];
    interstitial.delegate = self;


    //Initialized Close Button
    closeButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    closeButtonLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 28, 28)];
    closeButtonLabel.layer.cornerRadius = 14;
    closeButtonLabel.textAlignment = NSTextAlignmentCenter;
    [closeButtonLabel setText:@"x"];
    [closeButtonLabel setTextColor:[UIColor blackColor]];
    [closeButtonLabel setBackgroundColor:[UIColor whiteColor]];
    closeButtonLabel.layer.borderColor = [[UIColor blackColor] CGColor];
    closeButtonLabel.layer.borderWidth = 2;
    closeButtonLabel.layer.masksToBounds = YES;

    [closeButton addTarget:self action:@selector(closeButtonDown) forControlEvents:UIControlEventTouchDown];
}

- (void) ShowiAdInterstitial
{
    if(interstitial != nil && interstitial.isLoaded)
    {
        placeHolderView = [[UIView alloc]self.view.frame];
        [self.view addSubview:placeHolderView];

        [self.view addSubview:closeButton];
        [self.view addSubview:closeButtonLabel];

        [self requestInterstitialAdPresentation];
        [UIViewController prepareInterstitialAds];
        [interstitial presentInView:placeHolderView];
    }
}

任何想法是什么问题?

0 个答案:

没有答案