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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:18:26+00:00 2026-05-20T01:18:26+00:00

hi i am working with Twitter, i got problem with images, i have tweet

  • 0

hi i am working with Twitter, i got problem with images, i have tweet view have UITableview, it contains all tweet with user photo, if i load those photos in each cell when i scroll the UITableview, it scrolling very very slowly please suggest me to reduce the memory size of photos and scroll the UITableView fast.

i heard the thumbnail can reduce the memory size, does it.(if not which method i have to choose and what thumbnail method do’s) if so how to do that in this code (table view cell code)

 //Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

     static NSString *identifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];


    if(!cell) {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewStyleGrouped reuseIdentifier:nil] autorelease];

    UIImageView *myImage = [[UIImageView alloc]initWithFrame:CGRectMake(6,10,58,60)] ;

    NSURL *url = [NSURL URLWithString:[(Tweet*)[tweetArray objectAtIndex:indexPath.row] image_url]]; //here Tweet is other class and image_url is method in the Tweet class

    NSData *data = [[NSData alloc] initWithContentsOfURL:url];

    [myImage setImage: [UIImage imageWithData:data]];

    [cell.contentView addSubview:myImage];

    [myImage release];  

    }

    return cell;

}

Thank you,

please suggest me

  • 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-20T01:18:26+00:00Added an answer on May 20, 2026 at 1:18 am

    The reason for slow scroll of the table view is that you are trying to get the image data for every cell on the main thread. UI is getting blocked while it is going to fetch the image data from the URL and, According to me its not good to download images on main thread while table view is also loaded.

    Instead of using this approach, You should have to use NSOperationQueue, NSOperation and NSThread for async load of images to the appropriate cell.

    If you need more help or simple code like 2-3 function to download images async…

    Here are the functions….

    Where you are parsing/getting the values only call [self startLoading]; It will load images without blocking UI.

    - (void) startLoading {
       NSOperationQueue *queue = [[[NSOperationQueue alloc]init]autorelease];
       NSInvocationOperation *op = [[NSInvocationOperation alloc]initWithTarget:self selector:@selector(loadImagesInBackground) object:nil];
       [queue addOperation:op];
       [op release];
    }
    
    -(void) loadImagesInBackground {
          int index = 0;
          for (NSString urlString in [(Tweet*)[tweetArray objectAtIndex:indexPath.row] image_url]) {
               NSURL *url = [NSURL URLWithString:urlString];
               NSData *data = [[NSData alloc] initWithContentsOfURL:url];
               [myImageArray addObject: [UIImage imageWithData:data]];
               index++;
              if(index/3==0)
                [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
          }
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
         static NSString *identifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    
    
        if(!cell) {
    
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewStyleGrouped reuseIdentifier:nil] autorelease];
    
        UIImageView *myImage = [[UIImageView alloc]initWithFrame:CGRectMake(6,10,58,60)] ;
    
        [myImage setImage: [myImageArray objectAtIndex:indexpath.row]];
    
        [cell.contentView addSubview:myImage];
    
        [myImage release];  
    
        }
    
        return cell;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the twitter bootstrap dropdown buttons successfully working, but I have a tiny
I seem to have the Twitter Bootstrap carousel working properly as far as moving
I've just started working with mongodb got a perl script that parses a twitter
For some reason my json twitter parser isn't working? Anyone got any ideas as
I've currently got an app that me and a few mates have be working
I am currently working on app which is supposed to have Twitter integration. The
I have got a website where people can share activities just like Twitter, users
I'm trying to use Twitter Bootstrap in Django. I've got it working for the
I'm working with Twitter Bootstrap and using a fluid design with media queries to
I am working on twitter integration with android using Twiitter4j. I am trying to

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.