...
Code Block | ||
---|---|---|
| ||
class MainViewController: UiViewControlelr { var interstitialId:Int32 = -1; ... override func viewDidLoad() { super.viewDidLoad() ... interstitialId = RefineryAdFactory.shared.createInterstitial(...) ... // Set up an action on uiButton to display loaded interstitial with it's interstitialId. uiButton.addAction(UIAction(handler: {_ in RefineryAdFactory.shared.show(index: interstitialId) }), for: .touchUpInside) } ... } |
Load & Show on Event
Warning |
---|
This will increase the time it takes to show the interstitial and then recover app flow. Because its making the Ad Request when the user takes the action. You should use the previous approach where we make the request and store the ad ID for instant showing it when the user performs the actions. This is how we use Interstitial we use in Demos because it’s pretty good at showing that it works but nothing more |
Code Block | ||
---|---|---|
| ||
class MainViewController: UiViewControlelr {
...
override func viewDidLoad() {
super.viewDidLoad()
...
// Set up an action on uiButton to display loaded interstitial with it's interstitialId.
uiButton.addAction(UIAction(handler: {_ in
createInterstitial()
}), for: .touchUpInside)
}
...
} |