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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:49:49+00:00 2026-05-25T11:49:49+00:00

I am trying to change the accessor in a cell during some data loading

  • 0

I am trying to change the accessor in a cell during some data loading : when the user selects the cell, I load data from a JSON service, and during this load I want to display a spinner as accessor. When loaded, the next view controller display what needed. I use this code but the accessor is not changed (even if I wait in the thread before returning from the method):

 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    UIActivityIndicatorView *activityView = 
    [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    [activityView startAnimating];
    UIView *oldAccessorView = [cell accessoryView];
    [cell setAccessoryView:activityView];

    [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject: indexPath] withRowAnimation:UITableViewRowAnimationFade];

 MembersViewController *membersViewController = [[MembersViewController alloc] init];
            membersViewController.title = @"Members";

            // load the members, must be done in a separate thread and must change the cell accessor type to a spinner...
            JSONLoader *loader = [[JSONLoader alloc] init];
            NSString *membersURL = [NSString stringWithFormat:@"%@/members/all.json", jug.apiURL];
            NSMutableArray *members = [loader getMembersFromURL:membersURL];
            membersViewController.members = members;
            [loader release];
            [members release];

            [self.navigationController pushViewController:membersViewController animated:YES];
            [membersViewController release];


 // restore old accessor view
    [NSThread sleepForTimeInterval:5];

    [activityView stopAnimating];    
    [activityView release];
    [cell setAccessoryView:oldAccessorView];
  • 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-25T11:49:50+00:00Added an answer on May 25, 2026 at 11:49 am

    Not 100% sure I’m clear on the question. But the following might help:

    1) It’s not clear from this code that you are giving iOS the opportunity to update the display. It only does that at the end of the run loop. But from what I can make out all your code is running in the same pass as the run loop. If that diagnosis is right, then some judicious use of [self performSelector: @selector(method:) withObject: nil afterDelay: 0.0] will be needed.

    This question might be helpful background. The answer to a different questions illustrates how to deploy the performSelector:withObject:afterDelay: technique.

    2) Unless I’m missing something, you need to add [oldAccessoryView retain] before your [cell setAccessoryView: activityView] call. Then release it again after the subsequent `[cell setAccessoryView:oldAccessoryView]’. But maybe you are retaining the accessory view elsewhere.

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

Sidebar

Related Questions

I'm trying to change the background color of single cell be based on a
I'm trying to change default firstDayOfWeek for java.util.Calendar from SUNDAY to MONDAY. Is it
I'm trying to change user input in wildcard form (*word*) to a regular expression
I'm trying to change a site's home directory using powershell. This is what I
Am trying to change text of an asp:Button using jQuery Like this $(#<%=delButton.ClientID%>).attr('text', 'InActivate');
Im trying to change from big endian to little endian on a double. One
I'm trying to bind a Dependency Property from my UserControl to my MainViewModel. This
I am trying change from Delegates to Parallel.ForEach I see the below works fine.
im trying to change the text of a label from a class but have
Im trying to change the title from the activities inside the Tab. but the

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.