Giter Site home page Giter Site logo

Comments (9)

chrisjp avatar chrisjp commented on August 30, 2024

I just tried to reproduce this in my own app which uses storyboards and a navigation controller, and it worked fine. How are you setting up the storyboard?

This is the exact code I'm using in my app and it's working fine in both iOS 6 and 7:

UIStoryboard *storyboard;
if (!iPad)
    storyboard = [UIStoryboard storyboardWithName:@"StoryboardiPhone" bundle:nil];
else
    storyboard = [UIStoryboard storyboardWithName:@"StoryboardiPad" bundle:nil];
UINavigationController *navController = (UINavigationController*)[storyboard instantiateInitialViewController];

// init CJPAdController with the nav controller
_adController = [[CJPAdController sharedManager] initWithContentViewController:navController];

// set the ad controller as the root view controller
self.window.rootViewController = _adController;

from cjpadcontroller.

morismoris avatar morismoris commented on August 30, 2024

Ok,
now it works, but appears over the status bar.
schermata 2013-09-30 alle 18 33 47

from cjpadcontroller.

chrisjp avatar chrisjp commented on August 30, 2024

Oh yeah I see that happens when the position is set to top. I think this is to do with the way iOS 7 now displays view controllers and status bars. I've tried setting the edgesForExtendedLayout property but it has no effect. Might have to manually move it down by 20px if I can't find a proper solution. I'll look into this more. tomorrow.

from cjpadcontroller.

morismoris avatar morismoris commented on August 30, 2024

I noticed that in viewDidLayoutSubviews: it may happen that both _iAdView and _adMobView are not null
then both branches if

if (_iAdView) {
....
}

if (_adMobView) {
....
}

are perfomed and AdMob wins! Or if _iAdView != null and _adMobView == null?
I'm not sure you understand all the logic (_showingAdMob and _showingiAd), but it would take something like:

if ((_iAdView != null && _adMobView == null) || (_iAdView != null && _adMobView != null && [kDefaultAds isEqualToString:@"iAd"]))
{
... show iAd
}
else if ((_iAdView == null && _adMobView != null) || (_iAdView != NULL && _adMobView != null && [kDefaultAds isEqualToString:@"AdMob"]))
{
... show AdMob
}
else
{

}

from cjpadcontroller.

fbradyirl avatar fbradyirl commented on August 30, 2024

I'm also having the status bar issue when using the 'top' option. My workaround is to place the ads at the bottom although this is not the best place for me.

from cjpadcontroller.

chrisjp avatar chrisjp commented on August 30, 2024

I managed to half fix this problem, but I think (at least in my opinion) it looks awful in this position in iOS 7. It breaks the unified look of the status bar + nav bar pretty badly. In iOS 5 and 6 it was fine, but in iOS 7 it just looks ugly.
I think it would be best if when the ad position is set to "top" the ad is displayed under the nav bar rather than under the status bar. That is currently where I'm planning to go with the code. At the moment I'm having trouble fixing it in either way though. Fixing one part of the problem breaks another...

from cjpadcontroller.

chrisjp avatar chrisjp commented on August 30, 2024

Ignore my previous comment. Turns out that way would be even more complicated. I believe I've managed to fix the issue, but I'll try to test a few more possible use cases before pushing the code.

from cjpadcontroller.

chrisjp avatar chrisjp commented on August 30, 2024

Just pushed an update, it should fix the problems you were having. Can you confirm so I can close this? Or if there's still errors let me know.

@morismoris I just saw your other comment about both ad views not being nil and admob winning. I actually cleaned up that code during this update, I'll have a look now to see if it's still possible that could happen, if I did things right it shouldn't be!

from cjpadcontroller.

morismoris avatar morismoris commented on August 30, 2024

Ok, great job! Now it works.
Thank you so much!

from cjpadcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.