【发布时间】:2017-08-27 13:22:44
【问题描述】:
我用 Xcode (swift) 制作了一个应用程序,并且我已经在应用程序中实现了 AdMob 插页式广告,但我知道显示广告的唯一方法是单击按钮,广告就会显示,我想在 webView 中显示广告而不需要任何按钮点击,就像有人在几秒钟后向下滚动时会弹出广告。这可能吗?
这是我目前正在使用的
var interstital: GADInterstitial!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
interstital = GADInterstitial(adUnitID: "")
let request = GADRequest()
interstital.load(request)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func Ad(_ sender: Any) {
if (interstital.isReady) {
interstital.present(fromRootViewController: self)
interstital = CreateAd()
}
}
func CreateAd() -> GADInterstitial {
let interstital = GADInterstitial (adUnitID: "")
interstital.load(GADRequest())
return interstital
}
【问题讨论】:
标签: ios swift xcode firebase admob