是否可以在uitableviewcontroller或uicollectionviewcontroller中添加UIView(Admob) [英] Is it possible to add UIView (Admob) in uitableviewcontroller or in uicollectionviewcontroller

查看:102
本文介绍了是否可以在uitableviewcontroller或uicollectionviewcontroller中添加UIView(Admob)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在uitableviewcontroller或屏幕底部的uicollectionviewcontroller中添加admob。因此,我必须在uitableview控制器或uicolleectionview控制器的底部添加uiView(GAD BannerView)。那我该怎么做呢?
实际上我们可以在uiviewcontroller中轻松添加uiview但是如何在uitableviewcontroller或uicollectionviewcontroller中添加它?

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?

推荐答案

是的你也可以在 UITableView UICollectionView 中添加Ad Mob。 UITableViewController 有一个属性工具栏。您可以将AdMob添加到工具栏,如下所示。

Yeah 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];

这篇关于是否可以在uitableviewcontroller或uicollectionviewcontroller中添加UIView(Admob)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆