0
我想在我的選項卡式應用中添加橫幅廣告,但我無法做到。 如何實現橫幅添加? 這是我tried-如何在swift中實施Google AdMobs橫幅廣告?
import UIKit
import GoogleMobileAds
class ViewController: UIViewController {
var banner : GADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
loadBanner()
}
func loadBanner(){
banner = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
banner.adUnitID = "my_app_id"
banner.rootViewController = self
let req : GADRequest = GADRequest()
banner.loadRequest(req)
banner.frame = CGRectMake(0, view.bounds.height - banner.frame.size.height, banner.frame.size.width, banner.frame.size.height)
self.view.addSubview(banner)
}