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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:07:23+00:00 2026-05-11T16:07:23+00:00

I am building a teensy tiny little Twitter client on the iPhone. Naturally, I’m

  • 0

I am building a teensy tiny little Twitter client on the iPhone. Naturally, I’m displaying the tweets in a UITableView, and they are of course of varying lengths. I’m dynamically changing the height of the cell based on the text quite fine:

- (CGFloat)heightForTweetCellWithString:(NSString *)text {
  CGFloat height = Buffer + [text sizeWithFont:Font constrainedToSize:Size lineBreakMode:LineBreakMode].height;
  return MAX(height, MinHeight);
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  NSString *text = // get tweet text for this indexpath
    return [self heightForTweetCellWithString:text];
  }
}

I’m displaying the actual tweet cell using the algorithm in the PragProg book:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  static NSString *CellIdentifier = @"TweetCell";
  TweetCell *cell = (TweetCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    cell = [self createNewTweetCellFromNib];
  }
  cell.tweet.text = // tweet text
  // set other labels, etc
  return cell;
}

When I boot up, all the tweets visible display just fine. However, when I scroll down, the tweets below are quite mussed up — it appears that once a cell has scrolled off the screen, the cell height for the one above it gets resized to be larger than it should be, and obscures part of the cell below it. When the cell reaches the top of the view, it resets itself and renders properly. Scrolling up presents no difficulties.

Here is a video that shows this in action: http://screencast.com/t/rqwD9tpdltd

I’ve tried quite a bit already: resizing the cell’s frame on creation, using different identifiers for cells with different heights (i.e. [NSString stringWithFormat:@"Identifier%d", rowHeight]), changing properties in Interface Builder…

If there are additional code snippets I can post, please let me know. Thanks in advance for your help!

  • 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-11T16:07:23+00:00Added an answer on May 11, 2026 at 4:07 pm

    Sigh. Turns out I didn’t tweak all the properties just quite well enough. But at least I’m rid of that bug. 🙂

    This behavior was fixed by being sure to check the “Clip Subviews” property of the UITableViewCell.

    The behavior was caused by declaring my tweet text label to be of the maximum height necessary — when the subviews of the table cell were not clipped, the label in the cell above would render overtop of the cell below. This was not visible on the first rendering of the screen due to the order that the SDK renders the cells — downward — and how it stacks each one above the other.

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

Sidebar

Related Questions

Building a client-side swing application what should be notified on a bus (application-wide message
Building a site on CargoCollective, but it appears they use jQuery 1.4.2 which seems
When building an iPhone app that uses the Core Plot framework, I am seeing
Building an overly fancy HTML mail for a client. Code validates at http://validator.w3.org as
Building an iPhone application. The delegate loads a SplashScreenView which sits there until the
I have a teeny tiny little issue concerning a jQuery-based slideshow in Opera. What
Building an iPhone app, using: Xcode 4.1 Base SDK iOS 4.3 Apple LLVM Compiler
Building a mobile site and wanted to create a rotator that would work just
Building a lottery scratch-card app in Java. Have allot of it done, just need
Building on How Do You Express Binary Literals in Python , I was thinking

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.