Skip to content

Instantly share code, notes, and snippets.

@kwylez
Created November 11, 2010 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwylez/671894 to your computer and use it in GitHub Desktop.
Save kwylez/671894 to your computer and use it in GitHub Desktop.
- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
if (adBannerView != nil) {
[super configureIAdContentSizes];
[UIView beginAnimations:@"fixupViews" context:nil];
CGFloat toolbarHeight = self.toolbar.frame.size.height;
if (adBannerViewIsVisible) {
CGRect adBannerViewFrame = [adBannerView frame];
CGRect contentViewFrame = self.tblView.frame;
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = 0 + toolbarHeight;
[adBannerView setFrame:adBannerViewFrame];
contentViewFrame.size.height -= [self getBannerHeight:toInterfaceOrientation];
contentViewFrame.origin.y = UIInterfaceOrientationIsLandscape(toInterfaceOrientation) ?
[self getBannerHeight:toInterfaceOrientation] + toolbarHeight + 30 :
[self getBannerHeight:toInterfaceOrientation] + toolbarHeight + 10;
self.tblView.frame = contentViewFrame;
} else {
CGRect adBannerViewFrame = [adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = -([self getBannerHeight:toInterfaceOrientation] + toolbarHeight);
[adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = self.tblView.frame;
contentViewFrame.origin.y = 0 + toolbarHeight;
contentViewFrame.size.height = self.tblView.frame.size.height;
self.tblView.frame = contentViewFrame;
}
[UIView commitAnimations];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment