Comments (9)
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.
Ok,
now it works, but appears over the status bar.
from cjpadcontroller.
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.
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.
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.
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.
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.
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.
Ok, great job! Now it works.
Thank you so much!
from cjpadcontroller.
Related Issues (20)
- Using Different Admob Ad Unit IDs? HOT 1
- ...init adController directly in viewcontroller? HOT 2
- iAd resize problem HOT 7
- Exiting a full screen video hides the status bar permanently HOT 8
- iPad iOS 7 wrong device orientation HOT 10
- AdMob targeting issue HOT 2
- No visible @interface for 'GADrequest' ... HOT 4
- Ad not shown when custom UIViewController is really a UINavigationController HOT 3
- Removed banner still shows up if canceled before initialDelay time passed HOT 1
- Compilation error HOT 19
- Status bar and Banner on top HOT 5
- Status Bar disappears when playing fullscreen video HOT 1
- 3. Set up your navigation controller as usual, help me fix this step
- Hidding the banner in one screen HOT 1
- Problem with Layout in Swift implementation HOT 1
- Can't install when using use_frameworks HOT 1
- Keep Ad Banner on presenting modal view?
- Status Bar Style default HOT 1
- Compatibility with pod "Google/AdMob" HOT 1
- Status bar being hidden
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cjpadcontroller.