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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:08:57+00:00 2026-05-15T10:08:57+00:00

I’m working on a UITableView whose cells contain an UIImageView subclass which gets data

  • 0

I’m working on a UITableView whose cells contain an UIImageView subclass which gets data from a URL and cache images to the iphone disk.

Problem is, event with cached images the scrolling tends to be stuttering. So I searched a bit and found ABTableViewCell ( github.com/enormego/ABTableViewCell ) which is supposed to dramatically improve scrolling smoothness.

But, even with the example provided ( blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview ) I don’t really get what I am supposed to do.

I tried to do this: I created a class which inherits ABTableViewCell, added some UILabels and the UIImageView as class properties, and implemented methods this way: allocate and initialize subviews (labels, image) in the initialize class method, storing them in static pointers, and then set class properties in - (void)drawContentView:(CGRect)r highlighted:(BOOL)highlighted along with background color setting shown in example. Here’s the result:

static AsyncUIImageView* image = nil; // A subclass using ASIHTTPRequest for image loading
static UILabel*       label1 = nil;
static UILabel*       label2 = nil;

+ (void)initialize {
    if (self == [ResultTableViewCell class]) {
        image = [[[AsyncUIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 60)] retain];

        label1 = [[[UILabel alloc] initWithFrame:CGRectMake(90, 5, 150, 30)] retain];
        label1.font = [UIFont fontWithName:@"Helvetica-Bold" size:17];
        label1.textColor = [UIColor purpleColor];
        label1.backgroundColor = [UIColor clearColor];

        label2 = [[[UILabel alloc] initWithFrame:CGRectMake(180, 8, 100, 25)] retain];
        label2.font = [UIFont fontWithName:@"Helvetica-Bold" size:12.0];
        label2.textColor = [UIColor grayColor];
        label2.backgroundColor = [UIColor clearColor];
    }
}

- (void)drawContentView:(CGRect)r highlighted:(BOOL)highlighted {
    if (self.imageView == nil) {
        self.imageView = image;
        [self addSubview:image];

        self.firstLabel = label1;
        [self addSubview:label1];

        self.secondLabel = label2;
        [self addSubview:label2];
    }

CGContextRef context = UIGraphicsGetCurrentContext();

    UIColor *backgroundColor = [UIColor whiteColor];
    UIColor *textColor = [UIColor blackColor];

    if (self.selected || self.highlighted) {
        backgroundColor = [UIColor clearColor];
        textColor = [UIColor whiteColor];
    }

    [backgroundColor set];
    [textColor set];
    CGContextFillRect(context, r);      
}

This gives me completely black cells, sometimes one has text and image set with correct colors, but its content changes as I scroll down.
Obviously I did not understand what I am supposed to do in drawContentView.

Could someone explain its purpose?

  • 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-15T10:08:57+00:00Added an answer on May 15, 2026 at 10:08 am

    The whole idea is to not add subviews, but to draw the text instead.
    Eg.

    - (void)drawContentView:(CGRect)r highlighted:(BOOL)highlighted {
    
        [someText drawInRect:r withFont:aFont];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i want to parse a xhtml file and display in UITableView. what is the
Does anyone know how can I replace this 2 symbol below from the string

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.