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

Possible code changes #39

Closed benzle closed 11 years ago

benzle commented 11 years ago

Hi Larsacus:

Thanks for your sharing. I have possible code changes.

}

larsacus commented 11 years ago

I think a more accurate fix for this would be:

- (void)destroyAllAdBanners{
    NSArray *instances = [self.adapterInstances allValues];

    for (id <TOLAdAdapter> adapterInstance in instances) {
        if (adapterInstance.adVisible) {
            [self animateBannerForAdapterHidden:adapterInstance withCompletion:^{
                [self cleanUpAdAdapter:adapterInstance];
            }];
        }
        else{
            [self cleanUpAdAdapter:adapterInstance];
        }
    }

    [self.adapterInstances removeAllObjects];
}

Either way, you're right - this is missing some cleanup for the purpose that this method will be used for. I also don't think that the ad container should remove itself from its superview. I believe that should be the responsibility of the view or view controller that is hosting this.

larsacus commented 11 years ago

Closing this as the change was already made in master.