出现iAD时,不会调整iOS子视图的大小

时间:2012-06-05 10:55:50

标签: iphone objective-c ios xcode cocoa-touch

我有一个有3个视图的viewController(+ adView)。 bannerViewDidLoadAd事件被正确触发,然后我想调整我的视图大小以使iAd可见。但是,视图不会调整大小,控制台会显示一条消息,告知iAd可能会被遮挡。如何把它带到前面并调整视图大小?谢谢。

- (void)bannerViewDidLoadAd:(ADBannerView *)banner {

    if (!self.bannerIsVisible) { //&& iniciBanner


        self.bannerIsVisible = YES;

        [self.view addSubview:adView];


        [UIView beginAnimations:@"animatedAdBannerOn" context:NULL];
        //adView.frame = CGRectOffset(adView.frame, 0, adView.frame.size.height);
        [UIView commitAnimations];

        self.view.frame = CGRectMake(0, adView.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - adView.frame.size.height);

        self.vistaB.frame = CGRectMake(0, adView.frame.size.height, self.vistaB.frame.size.width, self.vistaB.frame.size.height - adView.frame.size.height);

        self.vistaSocial.frame = CGRectMake(0, adView.frame.size.height, self.vistaSocial.frame.size.width, self.vistaSocial.frame.size.height - adView.frame.size.height);

        [self.view bringSubviewToFront:adView];
    }   
}

1 个答案:

答案 0 :(得分:0)

从您的代码中看起来一切正常,所以我最好的猜测是您忘记将视图的IBoutlet与Xib的UViews连接起来。