0

I am working on a hybrid application using Phone gap and iOS. I am integrating google admobs into the app.I have a main view controller class where i have implemented google ads. I have created a GADbannner view and added it as a subview to the self.view. This way ads are visible on each page of the application. Below my ads I have a Cordova web view. Now I also have a javascript class in the www folder of the app.I want to hide this banner view from javascript class. How can I do this?

Please find my code of Main View controller with ads integrated:

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    self.webView.frame=CGRectMake(0, 90, 320, 370);
    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
}
    // for iphone
else
{
    self.webView.frame=CGRectMake(0, 50, 320, 410);

    NSLog(@"page co-ordinates are set");
    bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
}

self.webView.contentMode=UIViewContentModeScaleAspectFill;

bannerView_.adUnitID = MY_BANNER_UNIT_ID;
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
David Berry
  • 40,941
  • 12
  • 84
  • 95
Megha Jain
  • 107
  • 5
  • create a plugin http://docs.phonegap.com/en/3.5.0/guide_hybrid_plugins_index.md.html#Plugin%20Development%20Guide – jcesarmobile Jan 22 '15 at 15:23
  • Been answered before: http://stackoverflow.com/questions/21927612/call-objective-c-method-from-javascript – puzzl Jan 22 '15 at 22:38
  • Both of these dint work for me..Can you help me with a sample code? – Megha Jain Jan 23 '15 at 07:09
  • It doesn't work that way, you should post the code that doesn't work, and explain the process you followed and we take a look, not the other way – jcesarmobile Jan 23 '15 at 08:19

0 Answers0