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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:09:52+00:00 2026-05-31T13:09:52+00:00

I have a UITableView with custom cells. Naturally, in cellForRowAtIndexPath I try to dequeue

  • 0

I have a UITableView with custom cells. Naturally, in cellForRowAtIndexPath I try to dequeue an old cell and reuse it. Each cell has a hierarchy of autoresized views: I set the frame of the top view when I set its content in cellForRowAtIndexPath, and its subviews change their frames accordingly. Note that row height is dynamic too.
It all works nice when I just scroll the table (with the rows of different content and frames). But I also have a text field in the same view as this table, so I need to scroll the table’s contents to compensate the keyboard being shown/hidden. I animate contentInset property for that:

// Called when the UIKeyboardWillHideNotification is sent
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
    NSTimeInterval animationDuration = [[aNotification.userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
    UIViewAnimationCurve animationCurve = [[aNotification.userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue];

    [UIView setAnimationCurve:animationCurve];
    [UIView animateWithDuration:animationDuration animations:^{
        messagesTable.contentInset = UIEdgeInsetsMake(0, 0, kHSTableBottomInset, 0);
        messagesTable.scrollIndicatorInsets = UIEdgeInsetsZero;
    }];
}

It works good as well, but there’s an interesting glitch: when keyboard is hidden and contentInset is animated back to normal (kHSTableBottomInset is a small value to keep margin), table reloads the cells that will scroll from above to be displayed. The problem is that this reloading is done inside the animation block too! As a result, when I change the dequeued subview frame (specifically, width) in cellForRowAtIndexPath (which is called as a part or reloading), this change is animated too and it’s visible as the cell scrolls down to view.
Can I avoid such behavior?

  • 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-31T13:09:52+00:00Added an answer on May 31, 2026 at 1:09 pm

    I finally found the solution: frame-setting code can be excluded from animation like this:

    [CATransaction begin];
    [CATransaction setDisableActions:YES];
    mainDataView.frame = rect;
    [CATransaction commit];
    

    or

    [UIView setAnimationsEnabled:NO];
    mainDataView.frame = rect;
    [UIView setAnimationsEnabled:YES];
    

    Found the answer here: How can I exclude a piece of code inside a core animation block from being animated?

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

Sidebar

Related Questions

I have a UITableView with two custom cells and each of them has a
Currently I have a UITableView with custom cells and in each cell there is
I have a UITableView with custom cells. Inside each cell is 2 views. Each
I have a UITableView with custom cells. The cells containing one UITextView each and
In my app, I have a UITableView which has some custom cells and in
I have a UITableView with custom background images in each cell. The bottom cell
I have a UITableView with custom Cells. These cells are containing each an OpenGL
I have a UITableView with custom cell that I have built. In each custom
I have a UITableView, and custom cells on it. On cell I have a
I have following problem: I've got an UITableView with 7 custom cells. Each of

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.