Ios 是否可以在uitableviewcontroller或uicollectionviewcontroller中添加UIView(Admob)
我想在屏幕底部的uitableviewcontroller或uicollectionviewcontroller中添加admob。因此,我必须在uitableview控制器或UICollectionView控制器的底部添加uiView(GAD BannerView)。那我该怎么做呢?Ios 是否可以在uitableviewcontroller或uicollectionviewcontroller中添加UIView(Admob),ios,objective-c,uitableview,uicollectionview,admob,Ios,Objective C,Uitableview,Uicollectionview,Admob,我想在屏幕底部的uitableviewcontroller或uicollectionviewcontroller中添加admob。因此,我必须在uitableview控制器或UICollectionView控制器的底部添加uiView(GAD BannerView)。那我该怎么做呢? 事实上,我们可以在uiviewcontroller中轻松添加uiview,但如何在uitableviewcontroller或uicollectionviewcontroller中添加此功能?是的,您也可以在UIT
事实上,我们可以在uiviewcontroller中轻松添加uiview,但如何在uitableviewcontroller或uicollectionviewcontroller中添加此功能?是的,您也可以在
UITableView
或UICollectionView
中添加Ad Mob。uitableviewcontroller具有一个属性工具栏。您可以将AdMob添加到工具栏
,如下所示
[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];
是的,您也可以在
UITableView
或UICollectionView
UITableViewController
中添加Ad Mob,并使用一个属性工具栏。您可以将AdMob添加到工具栏
,如下所示
[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];
是的,这是可能的。您可以在tableview或collectionview的页眉或页脚视图中添加横幅广告。像在表视图中这样
UIView * bannerView = [[UIView alloc]initWithFrame:CGRectMake(0, 10,[[UIScreen mainScreen] bounds].size.width, 50)];
[bannerView setBackgroundColor:[UIColor clearColor]];
_tableView.tableFooterView = bannerView;
是的,这是可能的。您可以在tableview或collectionview的页眉或页脚视图中添加横幅广告。像在表视图中这样
UIView * bannerView = [[UIView alloc]initWithFrame:CGRectMake(0, 10,[[UIScreen mainScreen] bounds].size.width, 50)];
[bannerView setBackgroundColor:[UIColor clearColor]];
_tableView.tableFooterView = bannerView;
检查此链接检查此链接