创建自定义弹出式插页式广告的最佳方式是什么?
What is the best way to create a custom popup interstitial ad?
我目前有一个用 objc 和 swift 编写的应用程序。
我想实现一个自定义的弹出式插页式广告,它运行几秒钟,然后显示一个 X 以关闭弹出窗口,并每隔几分钟继续这样做,除非
Remove Ad的in-ap purchase已购买。
我已经设置了应用内购买。非常感谢您的帮助,否则 demo/sample 会很棒!
创建一个带有图像视图的单独控制器,它将根据应用程序委托中设置的计时器弹出。关闭 X 也应该有一个计时器
func applicationDidEnterBackground(application: UIApplication) {
if (!isShowingAd && adTimer != nil) {
adTimerTimeLeft = adTimer!.fireDate.timeIntervalSinceNow
adTimer!.invalidate()
}
if adUpdateTimer != nil
{
adUpdateTimerTimeLeft = 60 * 60 //one hour
self.adUpdateTimer!.invalidate()
}
}
//设置定时器,这样就可以设置定时器
var adTimer: NSTimer?
timer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: #selector(AppDelegate.updateAd), userInfo: nil, repeats: true)
timer?.fire()
我目前有一个用 objc 和 swift 编写的应用程序。
我想实现一个自定义的弹出式插页式广告,它运行几秒钟,然后显示一个 X 以关闭弹出窗口,并每隔几分钟继续这样做,除非 Remove Ad的in-ap purchase已购买。
我已经设置了应用内购买。非常感谢您的帮助,否则 demo/sample 会很棒!
创建一个带有图像视图的单独控制器,它将根据应用程序委托中设置的计时器弹出。关闭 X 也应该有一个计时器
func applicationDidEnterBackground(application: UIApplication) {
if (!isShowingAd && adTimer != nil) {
adTimerTimeLeft = adTimer!.fireDate.timeIntervalSinceNow
adTimer!.invalidate()
}
if adUpdateTimer != nil
{
adUpdateTimerTimeLeft = 60 * 60 //one hour
self.adUpdateTimer!.invalidate()
}
}
//设置定时器,这样就可以设置定时器
var adTimer: NSTimer?
timer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: #selector(AppDelegate.updateAd), userInfo: nil, repeats: true)
timer?.fire()