나는 광고를 얻으려면 Google AdMob Ads iOS 자습서를 따르고 있습니다. UITableView에 광고를 추가 할 때까지 모든 것이 잘 작동합니다. 제 디자인은 첫 번째 섹션에는 광고가 표시되고 두 번째 섹션에는 테이블 데이터가있는 표에 두 개의 섹션이 있어야합니다. 그러나 이것은 첫 번째 섹션에서 광고를 얻지 만 너무 잘 작동하지 않지만 10 번째 셀마다 반복됩니다. 나는 단지 한 번 광고를 원한다. 어떻게해야합니까? 여기 UITableView GADBannerView
내 코드는
...- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *refreshButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh:)];
self.navigationItem.rightBarButtonItem = refreshButtonItem;
[refreshButtonItem release];
// Create a view of the standard size at the bottom of the screen.
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
0.0,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"blablabla";
// 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 = self;
GADRequest *adMobRequest = [GADRequest request];
adMobRequest.testDevices = [NSArray arrayWithObjects:
GAD_SIMULATOR_ID, // Simulator
@"fafasfasdfasdrasdasfasfaasdsd", nil];
// Initiate a generic request to load it with an ad.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
if (section == 0) {
return 1;
} else {
return 50;
}
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
if (indexPath.section == 0) {
if (indexPath.row == 0) {
[cell addSubview:bannerView_];
}
} else {
cell.textLabel.text = @"Test";
cell.detailTextLabel.text = @"Test";
cell.imageView.image = nil;
}
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 50;
}
은 생산이 ..
사용자가 화면에 표시하기 전에 광고를 작성하여 노출을 보낼 tableviewcell에 추가하기 전에 광고를 요청하고 있습니다.이 광고는 어느 누구도 미친 것으로 간주 될 수 있습니다. –