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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:27:07+00:00 2026-05-28T21:27:07+00:00

I have a tableview whose contents are generated with json array. It also employes

  • 0

I have a tableview whose contents are generated with json array. It also employes location services so as users’ location changes, the table is reloaded to reflect the changes of the table data relative to users’ location.

My problem is I show the activity indicator in the beginning of the view load, but each time location updates and table reloads, the indicator is shown. This is done in very short intervals, causing the application to crash.

Is it possible to put a condition to following code so that it wonT show MBProgressHUD if it is not the initial load but it is there reload caused by the location changes?

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
    [self.navigationController.view addSubview:HUD];
    [HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
    return [rows count];
}

This is where the reload is performed:

    - (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{

    NSString *lat = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];

    NSString *longt = [NSString stringWithFormat:@"%f", newLocation.coordinate.longitude];

    //CGFloat Alat = [lat floatValue];
    //CGFloat Alon = [longt floatValue];
    self.aalat = lat;
    self.aalon = longt;
    //        NSLog(@"anlat: %@", aalat);
    //        NSLog(@"anlong: %@", aalon);
    [[NSUserDefaults standardUserDefaults] setObject:aalat forKey:@"latitude"];
    [[NSUserDefaults standardUserDefaults] setObject:aalon forKey:@"longitude"]; 
    [tableview reloadData];
}
  • 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-28T21:27:08+00:00Added an answer on May 28, 2026 at 9:27 pm

    I would trigger the HUD from your viewDidLoad or viewWillAppear methods to load things up initially. Firing from the tableview is going to give you lots of problems. The tableview methods are fired repeatedly when the user scrolls, so you will always have issues with that going on.

    Fire a method from your location update to display the HUD. It has to run on the main thread anyway for the animations to work correctly. I would call the reload table from your new method to avoid any issues with your tableview.

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

Sidebar

Related Questions

I have a tableview whose columns are bound to an array controller. I'm programmatically
I am trying to have a tableview that leads to another tableview whose list
I have a UITableView whose data source is an NSMutableArray. The array contains NSMutableDictionaries
I have an NSImageCell table column whose valuePath is bound to a path supplied
I have a UITableView whose datasource is a NSMutableArray . The array consists of
i have a grouped table, and if i write: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
I have a subclassed nstableview whose data source array may increase, by calling reloadData:
I am developing a table view. To fill that table i have an array
I have a uitableview with cells whose behavior depends on what: - (UITableViewCell *)tableView:(UITableView
I have two table views in a single controller.One is grouped whose frame is

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.