あなたはちょうどあなたが望む効果を達成するために、あなたのAdBannerView
のアルファ値をアニメーション化できます。ここでは
import iAd
private var bannerView: AdBannerView!
override func viewDidLoad() {
super.viewDidLoad()
// Create your banner view however you want, and add it to your UI.
bannerView = AdBannerView()
bannerView.alpha = 0
addSubview(bannerView)
}
// When you want to show the ad, animate the alpha.
private func animateInAd(appearing: Bool) {
UIView.animateWithDuration(1.0) [weak self] {
self?.bannerView.alpha = appearing ? 1 : 0
}
}
あなたがbannerViewを提示することができ、別の方法です。それがアップし、スライドを終了したときには、広告の上にビューを削除することができます
import iAd
private var coverView: UIView!
private var bannerView: AdBannerView!
override func viewDidLoad() {
super.viewDidLoad()
// Create your banner view however you want, and add it to your UI.
bannerView = AdBannerView()
addSubview(bannerView)
// Create the cover view however you want, and add it above the banner view.
coverView = UIView()
addSubview(coverView)
}
private func animateInAd(appearing: Bool) {
let hideAdPosition = view.frame.size.height
let showAdPosition = hideAdPosition - bannerView.frame.size.height
UIView.animateWithDuration(1.0, animations: [weak self] {
self?.bannerView.frame.origin.y = appearing ? showAdPosition : hideAdPosition
}) { [weak self] success in
self?.animateCover(appearing: !appearing)
}
}
private func animateCover(appearing: Bool) {
UIView.animateWithDuration(1.0) [weak self] {
self?.coverView.alpha = appearing ? 1 : 0
}
}
を
EDIT:
ADInterstitialAd
Sについては、それらがNSObject
を継承し、あなたが呼び出す必要があり、明示的なメソッドを持っているように見えますそれらを提示するために注文する(presentInView:
およびpresentFromViewController:
)。したがって、これらの広告の表示方法を制御するための公開APIはありません(これは、広告がユーザーに表示されることをAppleが保証するためのものです)。
ちょうど親切な思い出、iADはAppleによって2016年6月に閉鎖されます.. – x4snowman
ありがとう!それを知らなかった。そして、交換はAppleによって提供されるでしょうか? – brumbrum
ここには交換はありません.. https://developer.apple.com/news/?id=01152016a – x4snowman