对于我公司的大多数应用程序,我们都会显示插页式广告。 首先我们加载它,当它加载时,我们显示它。
有时(很少)在过渡过程中出现插页式广告(例如 pushviewcontroller)。
我想知道在层次 View Controller 的另一个窗口中显示插页式广告是否是一个好的解决方案。
做类似的事情:
- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
mWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController* controller = [[UIViewController alloc] init];
controller.view.backgroundColor = [UIColor clearColor];
mWindow.backgroundColor = [UIColor clearColor];
mWindow.rootViewController = controller;
[mWindow makeKeyAndVisible];
[self.interstitial presentFromRootViewController:mWindow.rootViewController];
}
- (void) interstitialDidDismissScreen:(GADInterstitial *)ad {
[mWindow removeFromSuperview];
mWindow = nil;
}
丑吗?
最佳答案
我认为在层次 View Controller 的另一个窗口中显示插页式广告不是一个好的做法,我们不能说这是错误的。来自苹果文档,
The UIWindow class defines an object known as a window that manages and >coordinates the views an app displays on a device screen. Unless an app can display content on an external device screen, an app has only one window. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWindow_Class/
关于ios - 插页式实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31852005/