Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added method fixAdContainerFrame to reset ad container frame when con…

…tainer is added to view hierarchy (or when already added). Removed call for container to removeFromSuperview, since the ad banners seem to work just fine without it.
  • Loading branch information...
commit 9ba4b4d5edcc2eb0517802649524f7b68a77ecbb 1 parent f883ef8
@larsacus authored
Showing with 10 additions and 2 deletions.
  1. +1 −1  LARSAdController.h
  2. +9 −1 LARSAdController.m
View
2  LARSAdController.h
@@ -46,7 +46,7 @@
+ (LARSAdController *)sharedManager;
- (NSUInteger)retainCount;
- (void)addAdContainerToView:(UIView *)view withParentViewController:(UIViewController *)viewController;
-
+- (void)fixAdContainerFrame;
- (void)createContainerView;
- (void)createGoogleAds;
- (void)destroyGoogleAdsAnimated:(BOOL)animated;
View
10 LARSAdController.m
@@ -76,13 +76,14 @@ - (void)addAdContainerToView:(UIView *)view withParentViewController:(UIViewCont
if (![[view subviews] containsObject:[self containerView]]) {
NSLog(@"Adding ad container to view");
- [[self containerView] removeFromSuperview];
+ //[[self containerView] removeFromSuperview];
[self setParentViewController:viewController];
[self setParentView:view];
[self createContainerView];
[self createIAds];
[view addSubview:[self containerView]];
+ [self fixAdContainerFrame];
}
else{
//ad container exists, and bring to front
@@ -107,6 +108,13 @@ - (void)createContainerView{
}
}
+- (void)fixAdContainerFrame{
+ [[self containerView] setFrame:CGRectMake(0.0,
+ self.parentView.frame.size.height-self.containerView.frame.size.height,
+ self.parentView.frame.size.width,
+ self.containerView.frame.size.height)];
+}
+
#pragma mark -
#pragma mark iAd Delegate Methods
- (void)bannerViewDidLoadAd:(ADBannerView *)banner{
Please sign in to comment.
Something went wrong with that request. Please try again.