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 7861177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:35:38+00:00 2026-06-02T22:35:38+00:00

Im trying to resize the tableview’s height with a animation, it works fine by

  • 0

Im trying to resize the tableview’s height with a animation, it works fine by animating the tableview’s frame.size.height.

The problem is, i have a tableview that is 200px height and scrolled to the bottom, i want to animate this to 100px, i run a simple

[UIView animateWithDuration:0.245f animations:^{
 CGRect frame = tableview.frame;
 frame.size.height = 100.f;
 tableview.frame = frame;
}];

this works fine, but after i resized it it is no longer scrolled to the bottom of the tableview. i want the tableview to always be scrolled at the bottom while animating. i tried alot of differnet things like calling

[tablview scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

right before/after i start the resize animation, but i have not managed to get them to sync 100%. Is there a way to resize the tableview while the bottom of the tableview displays the last element of the scrollview.

  • 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-02T22:35:42+00:00Added an answer on June 2, 2026 at 10:35 pm

    I found a solution for my problem, there might very well be a better solution but this actually works quite well 🙂

    Before i start animating i see if the contentSize.height is larger than the target height, if so i do following:

    if (mMessages.contentSize.height > 150.f)
    {
        CGFloat expandedOffsetY = 52.f;
        CGFloat collapsedBottomOffset = (150.f + 18.f);
        CGFloat expandedBottomOffset = (MIN(320.f, mMessages.contentSize.height) + expandedOffsetY);
        tableFrame.origin.y = (collapsedBottomOffset - expandedBottomOffset) + expandedOffsetY;
    }
    else
    {   
        tableFrame.origin.y = 18.f;
        tableFrame.size.height = 150.f;
    }
    

    this will put the tableview in a minus origin.y, then i have wrapped the tableview inside a “parent” uiview with clip sub views = YES.

    Then i have a “completed” animation block that “resets” to the target values.

    CGRect tableFrame = mMessages.frame;
    tableFrame.origin.y = 18.f;
    tableFrame.size.height = 150.f;
    mMessages.frame = tableFrame;
    
    if (mMessages.contentSize.height > tableFrame.size.height)
    {
        float contentOffsetY = mMessages.contentSize.height - tableFrame.size.height;
        mMessages.contentOffset = CGPointMake(0.0f, contentOffsetY);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to resize an image that I have uploaded with a form.
I'm trying to resize a bunch of photos that have been previously uploaded via
My problem is the next: I am trying resize a image size depending a
i trying to resize the height of a flash object to the size of
I'm trying to resize an image in Silverlight 3 that has been submitted by
I'm trying to get a row in my table view to resize its height,
I am trying to resize my drawing area to a smaller size but whenever
I am trying to resize a video so that if fills 100% of its
I'm trying to resize an image that is uploaded to Drupal via a form.
I have been trying to resize my view inside a view Controller with no

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.