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

  • SEARCH
  • Home
  • 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 9157549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:02:45+00:00 2026-06-17T13:02:45+00:00

I have an auto-layout (constraint) based application and noticed that there is a problem

  • 0

I have an auto-layout (constraint) based application and noticed that there is a problem with a tableview after an orientation change. The repro steps are as follows (I have a very basic repro app – with a tableview and an add button that adds a new item).

  1. Rotate your application to Landscape mode so the tableview is now landscape.
  2. Add an item to the tableview see 1 below
  3. Rotate back to Portrait, the tableview will now float on horizontal pan (as though the scroll viewer content size is landscape), see [2]

1 Code to add

- (IBAction)onAdd:(id)sender {
    count ++;
    [self.tableView insertRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:count-1 inSection:0]] withRowAnimation:UITableViewRowAnimationBottom];
}

[2] Floating table view

enter image description here

Any ideas on how to work around this problem? Also, how can I tell if this is known issue or something I should report to Apple?

  • 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-06-17T13:02:47+00:00Added an answer on June 17, 2026 at 1:02 pm

    I think this is a bug; if you convert the project away from auto layout and set appropriate resizing masks, everything works just fine. You should file a bug, particularly since you have a simple sample project that reproduces it nicely.

    What is happening in your case is as you suspected – the scroll view’s content view remains at the landscape width, even though the view itself has resized to portrait, so you suddenly get the ability to horizontally drag.

    Luckily there are fairly simple workarounds. I experimented with various combinations of setNeedsLayout or setNeedsUpdateConstraints without success, but you can implement one of these two solutions:

    -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    {
        [self.tableView beginUpdates];
        [self.tableView endUpdates];
    }
    

    Or,

    -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    {
        CGSize contentSize = self.tableView.contentSize;
        contentSize.width = self.tableView.bounds.size.width;
        self.tableView.contentSize = contentSize;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem with the new Auto Layout feature. I have an
I am working on the auto layout. However, there is a small problem about
I have used auto complete textbox previously. That auto complete works only when i
The given problem I have the following view that includes a Navigation Bar, Search
I am trying to have the auto layout manager adjust the center point of
I have a layout that uses an EditText to let users search a database
I am having a problem with the new Auto Layout functionality. I add an
Hello i have an auto layout issue with UIScrollView and ModalViewController . Here are
I am using Auto Layout in my iPhone app and have a UIScrollView .
I have a fixed size layout, centered using margin: 0 auto . I wonder

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.