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

查看:19
本文介绍了是否可以在 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?

推荐答案

是的,您也可以在 UITableViewUICollectionView 中添加 Ad Mob.UITableViewController 有一个单一的属性工具栏.您可以将 AdMob 添加到 Toolbar,如下所示.

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

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

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