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

Global Disable Without Subclassing #124

Closed ghost closed 9 years ago

ghost commented 9 years ago

Is there anyway to not subclass and still fire some type of method similar to - (BOOL)shouldDisplayAds?

The subclassing works fine if you are using a UIViewController as your type, but I have a few view controllers that are UITableViewControllers.

I am looking to globally disable when the user purchases removeAd in app.

Thank You

larsacus commented 9 years ago

You can use the LARSBannerVisibilityDelegate to listen for banner changes that call back to your UI to respond to changes in ad visibility. You can then use - (void)destroyAllAdBanners; to kill all ads if you need to destroy ads that are already on screen (maybe as the result of an in-app purchase to remove ads). As for replicating the functionality in shouldDisplayAds, the only code using that function is in viewWillAppear and is conditionally adding the ad controller whenever shouldDisplayAds is true.

All of this code is in TOLAdViewController.m and all of the above methods are documented in LARSAdController.h.

Let me know if this does not work for you.

ghost commented 9 years ago

Ah okay so instead of using the shouldDisplayAds, I can just do my check in the viewWillAppear in my own class and either add the ad or not.

Thanks for the help.

Great library by the way! :beers: