2
私はこの問題に対処しようとしていましたが、それを修正する方法を理解できません。Segueの前にAdmobインタースティシャルを追加するにはどうすればよいですか?
現在Admobをプロジェクトに追加してインタースティシャル広告を表示していますが、インタースティシャルを終了すると以前のVC(インタースティシャルインスタンスが作成されている)に戻ります。
以下に示すように、それらをTabbar関数に追加しようとしています。しかし、segueは決して起こらず、アラートはインタースティシャルの前に表示されません。私は広告を表示してから、VCにセグをしたいと思っていました。インタースティシャルを確認する前に、ユーザーにアラートを確認して[OK]を押してもらいたいです。
何か助けが素晴らしいだろう!
//TabBar Functions
func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
if (item.tag == 1) {
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
}
self.performSegueWithIdentifier("showStore", sender: nil)
} else if (item.tag == 2) {
let alert = UIAlertController(title: "Coming Soon!", message: "Loadout", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Got It!", style: .Default, handler: nil))
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
}
self.presentViewController(alert, animated: true, completion: nil)
return
} else if (item.tag == 3) {
let alert = UIAlertController(title: "Coming Soon!", message: "God's Tower", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Got It!", style: .Default, handler: nil))
if (self.interstitial.isReady) {
self.interstitial.presentFromRootViewController(self)
}
self.presentViewController(alert, animated: true, completion: nil)
return
}
}
恐ろしいダニエル!しかし、私はどのように私のタブバー機能でその機能を使用することができますか? – brkr
@brkrグローバル変数を使用してitem.tagの値を格納し、正しいView Controllerを表示するために前述したデリゲートメソッドでswitch文を使用します。 –