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

Problem with UIViewController that has ChildViewControllers #59

Closed Joseph310 closed 10 years ago

Joseph310 commented 10 years ago

Hi, My iPad app (only landscape) has a view controller which contains a child view controller on the left and a child tab bar controller on the right.

When I use [[LARSAdController sharedManager] addAdContainerToViewInViewController:self]; the Ads appear, but they are on top of the other views. For some reason the view controllers.view does not get resized.

Any tips?

Thanks

larsacus commented 10 years ago

Depends on what self actually is. If self is your split view controller, then it's possible this may not work. I have not tested adding the ads directly to a split view controller. The standard iAd guidelines for adding a banner ad on iPad would apply here, too. You may have to specify what view to add the views to by using addAdContainerToView:inViewController: instead.

Joseph310 commented 10 years ago

self is a "regular" view controller which contains two child view controllers each 50% in width, that are visible the entire time. Since the app is landscape only I wanted to display the ads directly below both child view controllers. I also tried wrapping the two view controllers in a full screen view controller and adding the ads to that, but that didn't work either. I also tried using the method you suggested to the container view and to both "halves" but no luck.

larsacus commented 10 years ago

It sounds like you're going to have to manage the ordering of your self's views in order to ensure that the ads are above all of the other content. When you think you have added the ad banner to your view, try debugging your view hierarchy using po [[UIWindow keyWindow] recursiveDescription] in the lldb console and make sure that the ad container is where you expect it to be (above all other view controller views).

Joseph310 commented 10 years ago

It is above, the others just don't get resized. Do I have to do this manually for this specific scenario?

larsacus commented 10 years ago

Yes, you must manage your views' view hierarchy and layout appropriately depending on what you want your app to do.