J'essaie de configurer iAd après avoir cliqué sur le bouton Annuler de JSSAlert. J'ai en fonction JSSAlert que définie alpha pour une vue complète 0,7 .. Et dans le contrôleur de vue je fonction pour iAd et reculer à 1,0 alpha ...IAd interstitiel retardé après avoir appuyé sur le bouton
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = "Vyhodnotenie testu"
self.showAlert()
}
func showAlert() {
func callback(){}
if numberOfPoints > 49 {
let customIcon = UIImage(named: "smile")
let alertview = JSSAlertView().show(self, title: "Gratulujeme! Uspeli ste.", text: "Dokončili ste test s počtom bodov \(numberOfPoints + 1) z \(maximumNumberOfPoints)!", buttonText: "OK!", color: UIColorFromHex(0x22c411, alpha: 1), iconImage: customIcon)
alertview.setTextTheme(.Light)
alertview.addAction(myCancelCallback)
self.navigationController?.navigationBar.alpha = 0.7
} else {
let customIcon = UIImage(named: "sad")
let alertview = JSSAlertView().show(self, title: "Ľutujeme! Neuspeli ste.", text: "Dokončili ste test s počtom bodov \(numberOfPoints + 1) z \(maximumNumberOfPoints)!", buttonText: "OK!", color: UIColorFromHex(0xd20606, alpha: 1), iconImage: customIcon)
alertview.addAction(myCancelCallback)
alertview.setTextTheme(.Light)
self.navigationController?.navigationBar.alpha = 0.7
}
}
func myCancelCallback() {
self.navigationController?.navigationBar.alpha = 1.0
self.interstitialPresentationPolicy = ADInterstitialPresentationPolicy.Automatic
}
func interstitialAdWillLoad(interstitialAd: ADInterstitialAd!) {
}
func interstitialAdDidLoad(interstitialAd: ADInterstitialAd!) {
interstitialAdView = UIView()
interstitialAdView.frame = self.view.bounds
view.addSubview(interstitialAdView)
interstitialAd.presentInView(interstitialAdView)
UIViewController.prepareInterstitialAds()
}
func interstitialAdActionDidFinish(var interstitialAd: ADInterstitialAd!) {
interstitialAd = nil
interstitialAdView.removeFromSuperview()
}
func interstitialAdActionShouldBegin(interstitialAd: ADInterstitialAd!, willLeaveApplication willLeave: Bool) -> Bool {
return true
}
func interstitialAd(interstitialAd: ADInterstitialAd!, didFailWithError error: NSError!) {
}
func interstitialAdDidUnload(var interstitialAd: ADInterstitialAd!) {
interstitialAd = nil
interstitialAdView.removeFromSuperview()
}
Alpha Retour à 1.0 en fonction myCancelCallback travaille mais iAd est retardé .. Qu'est-ce qui peut causer ce retard? Ou comment puis-je y faire face?
Je souhaite afficher iAd immédiatement après avoir appuyé sur OK !.
vidéo comment il fonctionne:
https://www.youtube.com/watch?v=r6LKN-cjaz8&feature=youtu.be
Vous utilisez la méthode ADInterstitialPresentationPolicy.Automatic qui va et demande l'annonce si elle est disponible, puis affichez-le pour que le processus prenne du temps. –
quoi de mieux à utiliser? – patrikbelis
s'il vous plaît vérifier ma réponse, je vous ai donné deux méthodes pour tester cela. –