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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:13:10+00:00 2026-05-30T14:13:10+00:00

I have a small app that lists a bunch of items in a database.

  • 0

I have a small app that lists a bunch of items in a database. If you click one of the items, the app switches to a new view that shows you all of the information on that particular item. Since the amount of information shown is dynamic, I do this by making the second view a UITableView and setting up the size of each row as needed for the particular object being shown. This normally works fine, but one of the items has a wall of text for the last item shown. When I try to view the information on this particular object, it doesn’t display anything where the wall of text should be.

While dubugging I can tell the text that is being used to determine the size the cell and label need to be is correct. It seems like it is determining a size correctly (it gives me a height of 21298 for the cell and 21294 for the label) and I can scroll down into what appears to be a rather large empty label. However, the display is a bit messed up, almost as if the screen was refreshing. The text at the top of the view stutters from where it started all the way to the top of the screen and the scroll bar on the right side doesn’t repaint correctly either.

Anyone seen something like this before?

Sorry, can’t post the screenshots I have since I don’t have enough rep

EDIT: Figured out an answer. I will post it as an answer once the minimum time passes.

I figured out a workaround, if anyone else runs into this.

After some digging around, I found out that when the source string length gets to around 41,000, it starts causing this drawing error. So I split up any string over ~30,000 and added multiple rows to the table. It now displays the entire wall of text.

Code:

#define FONT_SIZE 14.0f
#define CELL_CONTENT_WIDTH 320.0f
#define CELL_CONTENT_MARGIN 2.0f

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{    
  //static NSString *CellIdentifier = @"Cell";
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%d", [indexPath row]];
UILabel *label = nil;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

    label = [[UILabel alloc] initWithFrame:CGRectZero];
    [label setLineBreakMode:UILineBreakModeWordWrap];
    [label setMinimumFontSize:10.0];
    [label setNumberOfLines:0];
    [label setFont:[UIFont systemFontOfSize:FONT_SIZE]];
    [label setTag:1];

    if ([indexPath row] == 1 || [indexPath row] == 2)
    {
        [label setTextColor:[UIColor redColor]];
    }
    else if ([indexPath row] == 3)
    {
        [label setTextColor:[UIColor colorWithRed:0.0f green:150.f/255.f blue:30.f/255.f alpha:1.0f]];
    }
    else if ([indexPath row] == 5)
    {
        [label setTextColor:[UIColor colorWithRed:155.f/255.f green:145.f/255.f blue:0.0f alpha:1.0f]];
    }

    [[cell contentView] addSubview:label];
}

NSString *text = [cardInfo objectAtIndex:[indexPath row]];

CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN *2), 20000000000000.0f);
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];

if (!label)
{
    label = (UILabel *)[cell.contentView viewWithTag:1];
}

[label setText:text];
[label setFrame:CGRectMake(CELL_CONTENT_MARGIN, CELL_CONTENT_MARGIN, CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN *2), MAX(size.height, 30.0f))];

// Configure the cell...

return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *text = [cardInfo objectAtIndex:[indexPath row]];
CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN *2), 20000000000000.0f);
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
CGFloat height = MAX(size.height, 30.0f);
return height + (CELL_CONTENT_MARGIN * 2);
}
  • 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-30T14:13:12+00:00Added an answer on May 30, 2026 at 2:13 pm

    I figured out a workaround, if anyone else runs into this.

    After some digging around, I found out that when the source string length gets to around 41,000, it starts causing this drawing error. So I split up any string over ~30,000 and added multiple rows to the table. It now displays the entire wall of text.

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

Sidebar

Related Questions

I have a small app that has a Render thread. All this thread does
I have small app in that I manage sales territories. One territory can have
I have a small winforms app that creates a new event log source. I
I have an app in dev that involves a small list of people, a
I have small web app that generate PDF files as a report. I'm trying
I have a small app that downloads some files from a remote (HTTP) server
I have a relatively small app that Im building using vb.net 2.0, and nant.
I have a small WinForms app that utilizes a BackgroundWorker object to perform a
I have a small helper app that I use to inject scripts into html
I have written a small app that puts my bluetooth in discoverable mode for

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.