larsacus / LARSAdController

Lightweight ad mediation for iOS to properly manage multiple ad networks dynamically including iAd and Google ads.
http://theonlylars.com/blog/2013/01/10/stupid-easy-ads-with-larsadcontroller-3-dot-0/
MIT License
269 stars 60 forks source link

UISplitView and UITabView width potentially wrong #74

Open TwentyThreeDegrees opened 10 years ago

TwentyThreeDegrees commented 10 years ago

Hi - great library and it's easy to get up and running with it. I have a unique setup and I can't tell if my implementation is wrong or not but I am getting ad banners that are too wide for my view.

I have a UISplitView (iPad only) and the detail view is in fact a UITabViewController with UIViewControllers stacked inside it. Ideally I would like to display ads at the bottom of the UIViewControllers (which are therefore tabs).

Each time I get this to work though the Ad is too wide for the 'tab' - the logging reports that the ad space is coming back correctly:

LARSAdController [line 730]: Handling orientation change
LARSAdController [line 178]: View is landscape
LARSAdController [line 210]: Container frame: {{0, 613}, {768, 90}}

Seems fine, my own code agrees:

Size of view: {{0, 0}, {703, 768}}

However when a banner is returned I get stuff like this:

LARSAdController [line 474]: Initial banner frame <Google Ads>: {{-128, 90}, {1024, 90}}

Which as you can see is too wide and then goes off the screen. Reloading the tab sometimes causes me to get an appropriate response,

LARSAdController [line 499]: Final banner frame <Google Ads>: {{0, 0}, {768, 90}}

But even the it LOOKS off the screen - or should I just be ignoring that? Apologies if this is my being stupid.

At the moment I'm adding the code using this:

[[LARSAdController sharedManager] addAdContainerToView:self.tabBarController.view withParentViewController:self];

Although I have tried the simpler version with just self, and I've also tried the much simpler version where my UIViewController just inherits from the TOL class given, but both seem to produce the same results. Thanks.

larsacus commented 10 years ago

First off: thank you thank you thank for using my logs! This is a wonderfully presented issue!

Secondly, it looks like you are trying to present an ad inside one of the split panes. On the iPad (at least for iAds), you should be presenting the ads so that they span the entire length of the screen. The exception to this is if you are displaying the ads in a view controller that has the same width properties that the iPhone has (such as the master view controller in your split pane).

I don't believe iAds on the iPad were meant to be displayed in anything except full-width. Google ads act differently, however, so the specific issue you are experiencing with the Google ads may be due to another bug with the notorious UISplitViewController + UITabBarController problem that many have seen from using this view controller inception hierarchy.

TwentyThreeDegrees commented 10 years ago

Thank you for your quick reply!

In my specific instance if I try and display full width (by say setting the SplitViewController as the presenting view) then it covers my tab bars, thus making any selections impossible...

Do you think in this instance I should try forcing the banners into the smaller master width to work around this?

On 6 Apr 2014, at 20:24, Lars Anderson notifications@github.com wrote:

First off: thank you thank you thank for using my logs! This is a wonderfully presented issue!

Secondly, it looks like you are trying to present an ad inside one of the split panes. On the iPad (at least for iAds), you should be presenting the ads so that they span the entire length of the screen. The exception to this is if you are displaying the ads in a view controller that has the same width properties that the iPhone has (such as the master view controller in your split pane).

I don't believe iAds on the iPad were meant to be displayed in anything except full-width. Google ads act differently, however, so the specific issue you are experiencing with the Google ads may be due to another bug with the notorious UISplitViewController + UITabBarController problem that many have seen from using this view controller inception hierarchy.

— Reply to this email directly or view it on GitHub.

larsacus commented 10 years ago

I think forcing the banners into a smaller size for their respective platform (iPad, iPhone) might be frowned upon by iAd.