Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7528255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:19:42+00:00 2026-05-30T04:19:42+00:00

I have a view containing a UITableView. Above the table I’d like to display

  • 0

I have a view containing a UITableView. Above the table I’d like to display an iAd. I figured the best way to do this was to set the contentInset for the table to the height of the iAd banner – all good so far.

The app supports rotation, so I have this code:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {

    NSString *bannerSize = (UIInterfaceOrientationIsPortrait(interfaceOrientation)) ? ADBannerContentSizeIdentifierPortrait : ADBannerContentSizeIdentifierLandscape;
    int bannerHeight = [ADBannerView sizeFromBannerContentSizeIdentifier:bannerSize].height+1;

    iAdBanner.currentContentSizeIdentifier = bannerSize;
    [mainTable setContentInset:UIEdgeInsetsMake(bannerHeight, 0, 0, 0)];    
}

This works on the first rotate, but when I rotate back, the contentInset doesn’t appear to have been changed, in fact every time I rotate the device it appears to be set to the ‘inverse’ value

But it is working – in that if I attempt the scroll the table, everything jumps into place.

After much reading, I added the following line to the end of the code above:

[mainTable scrollRectToVisible:CGRectMake(0, 0, 10, 10) animated:NO];

This worked! – BUT – I don’t want the table to scroll back to the top every time the device is rotated, so I tried this:

[mainTable scrollRectToVisible:CGRectMake(mainTable.contentOffset.y+bannerHeight, 0, 10, 10) animated:NO];

But if I’m not at the top of the table the original problem reappears, in that the header of the current section (it’s a plain table) is about 20 pixels too high or too low, fixed immediately by manually scrolling.

So now I’m lost – any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:19:43+00:00Added an answer on May 30, 2026 at 4:19 am

    you probably would want to use a UIViewController instead of a UITableViewcontroller and addd the UITableView programmatically. Then, you can easily set the frames of the ad and the tableview. And when rotated, use the rotating methods to change the frames again!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table view containing multiple tabs, on this tabs i want to
I have a table containing view/click records. The time is stored in a unix
I have a UITableView inside of a View created from a NIB. the table
I have a basic View created in IB containing a UITableView and a UITextVIew.
I have made horizontally scrollable UITableView by adding a table view to a UISrollView
Hi say I have a view containing: <table> <tr> <th> Invoice Number </th> <th>
This is strange: I have a view containing a rotated CALayer. The layer is
I have a view containing a UIWebView which is loading a google map (so
I have an application with a view containing several subviews. The subviews did not
I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.