I want to add admob in uitableviewcontroller or in uicollectionviewcontroller at the bottom of screen. So for that I have to add uiView (GAD BannerView) at the bottom of uitableview controller or uicolleectionview controller. So how can I do this? Actually we can add uiview easily in uiviewcontroller but how can I add this in uitableviewcontroller or uicollectionviewcontroller?
Yes you can also add Ad Mob in UITableView
or UICollectionView
. UITableViewController
have a one property toolbar. You can add AdMob to Toolbar
as below.
[self.navigationController setToolbarHidden:NO];
self.banner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
self.banner.adUnitID = @"ca-app-pub-XXXXXXXX/XXXXXXXXX";
self.banner.rootViewController = self;
[self.navigationController.toolbar addSubview:self.banner];
GADRequest *request;
[self.banner loadRequest:request];
Yes, Its possible. you can add banner ad in header or footer view of tableview or collectionview. Like this in table view
UIView * bannerView = [[UIView alloc]initWithFrame:CGRectMake(0, 10,[[UIScreen mainScreen] bounds].size.width, 50)];
[bannerView setBackgroundColor:[UIColor clearColor]];
_tableView.tableFooterView = bannerView;
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.