简体   繁体   中英

How to use AdMob Banner Ads in TableView in iOS?

I want to show different ads between every 5 results in tableview I have used admob banner ads in my ios project Tableview shows same ads after every 5 results even I am using different ad unit id to load ad after every 5 rows.

Any solution to get different ads after 5 rows?

In cellForRowAtIndexPath, set admob banner cell every 5 rows

like this

    switch(indexPath.row) {
       case 5, 10, 15...: // every 5 rows, put admob banner cell
           let cell = [tableView dequeueReusableCellWithIdentifier: @"AdmobBannerTableViewCell"];
           return cell;
       case 1,... : // other rows...
           let cell = [tableView dequeueReusableCellWithIdentifier: @"AnotherTableViewCell"];
           return cell;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM