1

这是我的代码...

CGRect viewBounds = CGRectMake([[UIScreen mainScreen] applicationFrame].origin.x, 
[[UIScreen mainScreen] applicationFrame].origin.y, 
[[UIScreen mainScreen] applicationFrame].size.width, 
[[UIScreen mainScreen] applicationFrame].size.height-CGSizeFromGADAdSize(kGADAdSizeBanner).height);

 self.view.frame = viewBounds;

CGPoint origin = CGPointMake(0.0,theWebView.frame.size.height);

bannerView_ = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin] autorelease];


bannerView_.adUnitID = @"a151e39dc55f7f0";


bannerView_.rootViewController = self;

[self.view addSubview:bannerView_];

[self.view bringSubviewToFront:bannerView_];


GADRequest *request = [GADRequest request];

request.testDevices = [NSArray arrayWithObjects:
                       GAD_SIMULATOR_ID,                               // Simulator
                       @"heresthestringofmyphone",    // Test iPhone 3Gs 4.3.1
                       nil];

[bannerView_ loadRequest:request];
4

1 回答 1

0

self.view.frame = viewBounds;

CGPoint origin = CGPointMake(0.0,theWebView.frame.size.height);

而不是上面两行替换为以下代码,它就像魔术一样工作。

[超级 webView].frame=viewBounds;

CGPoint origin = CGPointMake(0.0,[super webView].frame.size.height);

于 2013-08-21T12:00:03.000 回答