Cocoa touch 将admob添加到基本appdelegate中,使其可以持久化,而不考虑所有视图

Cocoa touch 将admob添加到基本appdelegate中,使其可以持久化,而不考虑所有视图,cocoa-touch,admob,viewcontroller,persistent,Cocoa Touch,Admob,Viewcontroller,Persistent,我想将admob添加到基本应用程序委托中,这样我就可以有一个持久的广告,显示所有视图,而不是每次更改视图控制器时都刷新。 “bannerView_u2;.rootViewController=self;”是一个问题,我不知道如何让它在所有视图控制器上都工作。我如何才能从基本应用程序委派中获得应用程序上显示的当前viewcontroller 这是我目前在应用程序中使用的代码 - (BOOL)application:(UIApplication *)application didFinishLaun

我想将admob添加到基本应用程序委托中,这样我就可以有一个持久的广告,显示所有视图,而不是每次更改视图控制器时都刷新。 “bannerView_u2;.rootViewController=self;”是一个问题,我不知道如何让它在所有视图控制器上都工作。我如何才能从基本应用程序委派中获得应用程序上显示的当前viewcontroller

这是我目前在应用程序中使用的代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{


    // Create a view of the standard size at the bottom of the screen.
    bannerView_ = [[GADBannerView alloc]
                   initWithFrame:CGRectMake(0.0,
                                            self.window.frame.size.height -
                                            GAD_SIZE_320x50.height,
                                            GAD_SIZE_320x50.width,
                                            GAD_SIZE_320x50.height)];

    // Specify the ad's "unit identifier." This is your AdMob Publisher ID.
    bannerView_.adUnitID = @"a14e0dssddb01d";

    // Let the runtime know which UIViewController to restore after taking
    // the user wherever the ad goes and add it to the view hierarchy.
    bannerView_.rootViewController = self;


    // Initiate a generic request to load it with an ad.
    [bannerView_ loadRequest:[GADRequest request]];


    //[self.window addSubview:navController.view];
     [self.window addSubview:bannerView_];
    [self.window makeKeyAndVisible];

    return YES;
}