0
ネイティブ・エクスプレス広告をプロジェクトに統合したい。そして、私はtableviewでこれらの広告をバインドしたい、私は表示することはできません。いずれかの人がこの問題を解決するのを助けてください。Native Express広告ビューがUITableViewCellに表示されない
私はコードの下に、これを使用しています:
#pragma mark - UITableViewDataSource
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
return 150;
}
// number of section(s), now I assume there is only 1 section
- (NSInteger)numberOfSectionsInTableView:(UITableView *)theTableView
{
return 1;
}
// number of row in the section, I assume there is only 1 row
- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"HistoryCell";
// Similar to UITableViewCell, but
customcell *cell = (customcell *)[theTableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
cell = [[customcell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
dispatch_async(dispatch_get_main_queue(), ^{
[cell cellNativeAds:self];
})
return cell;
}
は、これは私のカスタムセルである:
-(void)cellNativeAds:(UIViewController*)rootVC {
self.nativeExpressAdView.adUnitID = @"ca-app-pub-404901943dsdsd4086773/3124124124";
self.nativeExpressAdView.rootViewController = rootVC;
self.nativeExpressAdView.delegate = self;
// The video options object can be used to control the initial mute state of video assets.
// By default, they start muted.
GADVideoOptions *videoOptions = [[GADVideoOptions alloc] init];
videoOptions.startMuted = true;
[self.nativeExpressAdView setAdOptions:@[videoOptions]];
// Set this UIViewController as the video controller delegate, so it will be notified of events
// in the video lifecycle.
self.nativeExpressAdView.videoController.delegate = self;
GADRequest *request = [GADRequest request];
[self.nativeExpressAdView loadRequest:request];
}