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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:13:34+00:00 2026-06-07T09:13:34+00:00

I have a UITableView filled with cells that display file names, and the cells

  • 0

I have a UITableView filled with cells that display file names, and the cells also indicate the upload/download progress of the files. When a file is being moved, its corresponding cell should show a UIActivityIndicatorView in its accessory view. I have a UIActivityIndicatorView set up and ready to go in viewDidLoad, but when I tried to set it as the accessory view for multiple cells, it only shows up in one cell.

-(void)viewDidLoad {

    [super viewDidLoad];

    activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    [activityIndicator startAnimating];

}


//...code that detects file changes and calls fileChange


-(void)fileChange {

    for (int i = 0; i < [self.cloudNames count]; i++) {

        //detect whether file name in array is uploading, downloading, or doing nothing

        NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0];
        UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];

        if (downloading) {

            cell.accessoryView = activityIndicator;
            //other changes here specific to downloads

        } else if (uploading) {

            cell.accessoryView = activityIndicator;
            //other changes here specific to uploads

        } else {

            cell.accessoryView = nil;

        }

    }

}

As I said, the activity indicator only shows in one cell even where there are multiple cells that should show it.

I don’t want to set up the UIActivityIndicatorView in the fileChange method (even though it works) because this method is called many times during the upload/download. If the method is called and the activity indicator is set up there, the activity indicator resets in all of the table view cells when the method is called, resulting in glitchy and unsmooth animations, and it causes a huge memory problem.

Any ideas of what to do? Thanks.

  • 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-06-07T09:13:37+00:00Added an answer on June 7, 2026 at 9:13 am

    Even if you are setting the activity indicator for the cell, you only ONE instance variable for it. The way to do this is to create an indicator for each cell inside tableView:cellForRowAtIndexPath:

    You can set a tag for the UIActivityIndicatorView and whenever you want to access it or grab it you can get the cell, and get the indicator view using [cellView viewWithTag:theTag]. No need for instance variables.

    If you want to make things even fancier you can subclass UITableViewCell and do whatever you want to do inside your custom cell..

    EDIT:

    To get the view you can either assign to the accessory view and just get the cells accessoryView:

     UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
    
     UIActivityIndicatorView *indicator = (UIActivityIndicatorView *) cell.accessoryView;
    

    or you can add the UIActivityIndicatorView to the cell`s contentView (that way you can place it where ever you want, you have more flexibility):

    adding the indicator:

    myIndicatorView.tag = 1;
    [cell.contentView addSubview:myIndicatorView];
    

    getting the indicator:

    UIActivityIndicatorView *indicator = [cell.contentView viewWithTag:1];
    

    hope this helps

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

Sidebar

Related Questions

Short Intro Currently I have a UITableView which is filled with custom cells that
I have a UITableView with Cells that are filled with the Objects of an
I have a UITableView with UITableViewCells that are filled in the cellForRowAtIndexPath method with
I have UITableView that will have several child UITableViews which may also have 1
I have a UITableView that I populate with data that i download over the
I have a UITableView that has cells of which, for this example, let's say
I have an UITableView showing custom view cells that I've designed in interface builder.
I have a working UITableView filled with some options for my app, and i
I have UITableView with images as rows (cells). I use EGOImageView to load images
I have UITableView with very large cells with lots of content (more than one

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.