我已经在 Swift 中成功实现了 iAd,除了出现广告时,它会重新配置self
. 如何使广告出现在屏幕前,并且不改变屏幕的大小?
这是我使用的代码:
class GameViewController: UIViewController, ADBannerViewDelegate {
var bannerView:ADBannerView?
override func viewDidLoad() {
super.viewDidLoad()
super.viewDidLoad()
self.canDisplayBannerAds = true
self.bannerView?.delegate = self
self.bannerView?.hidden = true
}
func bannerViewDidLoadAd(banner: ADBannerView!) {
self.bannerView?.hidden = false
}
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return willLeave
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
self.bannerView?.hidden = true
}
}
如何使广告出现在屏幕前,并且不改变屏幕的大小?