我有一个视图控制器ViewController
,其中我有两种方法,hideAd
并且showAd:
// Method is called when the iAd is loaded.
-(void)showAd:(ADBannerView *)banner {
// Creates animation.
[UIView beginAnimations:nil context:nil];
// Sets the duration of the animation to 1.
[UIView setAnimationDuration:1];
// Sets the alpha to 1.
// We do this because we are going to have it set to 0 to start and setting it to 1 will cause the iAd to fade into view.
[banner setAlpha:1];
// Performs animation.
[UIView commitAnimations];
}
// 当 iAd 加载失败时调用方法。
-(void)hideAd:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
// Creates animation.
[UIView beginAnimations:nil context:nil];
// Sets the duration of the animation to 1.
[UIView setAnimationDuration:1];
// Sets the alpha to 0.
// We do this because we are going to have it set to 1 to start and setting it to 0 will cause the iAd to fade out of view.
[banner setAlpha:0];
// Performs animation.
[UIView commitAnimations];
}
我希望能够从我的 skscenes 中调用这些方法,其中两个称为startview
and gameview
。我尝试实施此解决方案:如何在某个 SKScene 上显示 iAd 并将其隐藏在另一个上,但setDelegate
对我不起作用。我可以通过什么方式隐藏和显示我的横幅iads
?