내 앱 전체에 AdMob 배너를 추가하려고합니다. UIViewControllers에 관해서는 모든 화면의 맨 아래에 배치하고 올바르게 작동하지만 완전히 작동하지는 않습니다.정적 광고 배너를 UITableViewController에 추가하는 방법은 무엇입니까?
내가 그것을 화면 하단의 올바른 자리에 시작되고있는 UITableViewController에 추가하는 듯했지만 나는 테이블을 스크롤 할 때 그것을 함께 이동합니다. 나는 테이블을 스크롤 할 때 광고가 화면 하단에 정적으로 머물러 있어야합니다.
- (void)displayGAD
{
// The frame of the banner is initialized off screen.
// If an ad loads then it will animate onto the screen.
self.bannerView = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0,
self.view.frame.size.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
self.bannerView.adUnitID = self.adUnitID;
self.bannerView.delegate = self;
self.bannerView.rootViewController = self;
[self.view addSubview:self.bannerView];
[self.bannerView loadRequest:[self createRequest]];
}
- (GADRequest *)createRequest
{
GADRequest *request = [GADRequest request];
#warning Comment this out before distribution
request.testDevices = [NSArray arrayWithObjects:@"84ea3d9789cabb0a34176cbb52c0f992", @"abf08fe141b95987d27ac068602605b8", GAD_SIMULATOR_ID, nil];
return request;
}
- (void)adViewDidReceiveAd:(GADBannerView *)view
{
NSLog(@"Received Ad");
[UIView animateWithDuration:1.0 animations:^ {
view.frame = CGRectMake(0.0,
self.view.frame.size.height - view.frame.size.height,
view.frame.size.width,
view.frame.size.height);
}];
}
- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error
{
NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);
}
내가 여러 예를 본 나는 어떻게 할 것인가에 대한 구체적인 아무것도 테이블 뷰에 광고를 포함 할 수 있지만 수있는 방법에 관해서입니다 :
여기 내 코드입니다. 필자가 읽은 유일한 점은 컨테이너 뷰에 테이블 뷰를 놓은 다음 그 테이블에 광고를 추가해야한다는 것입니다. 비록 이것이 UITableViewController이기 때문에 나는 그것을 어떻게 할 것인지 모른다.
코드를 넣을 수 있습니까? 나는 또한 그것을 필요로하지만 iOS 프로그래밍에 익숙하지 않기 때문에 설명대로 따라 가기가 어렵다. – WebOrCode