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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:48:30+00:00 2026-06-01T00:48:30+00:00

I have an array of objects, and i use following code to get in

  • 0

I have an array of objects, and i use following code to get in in the tableview

[source addObjectsFromArray:[UDdelegate naturArray]];
    
[[self tableView]reloadData];

My application fetch some data on location change, and that data is the objects in my naturArray. source is the list’s datasource.

My problem is that if my list view is active while it is fetching the data, the list isn’t updated. If i go to the main menu and back into the listView the data appear.

Is there a way to get the list to update while its active ?

Thanks.

Edit: Full code

VisListe.h:
@class UdINaturenAppDelegate;
@class POI;
@class webDetailView;

@interface VisListe :  UITableViewController<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, retain,readwrite) IBOutlet NSMutableArray *dataSourceArray;

@property (strong, nonatomic) UdINaturenAppDelegate *UDdelegate;

@property (strong, nonatomic) POI *poi;

@property (strong, nonatomic) webDetailView *webView;

@property (strong, nonatomic) IBOutlet UITableView *tabel;

-(void)updateList;

-(NSString*)parseURL:(NSString*)url;
@end

VisListe.m:

@implementation VisListe
@synthesize dataSourceArray = source;
@synthesize UDdelegate;
@synthesize poi=_poi;
@synthesize webView = _webView;
@synthesize tabel = _tabel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.navigationItem.title = NSLocalizedString(@"Poi List", nil);
        
        UDdelegate = (UdINaturenAppDelegate*) [UIApplication sharedApplication].delegate;
        source = [[NSMutableArray alloc]init];
        _webView = [[webDetailView alloc] initWithNibName:@"webDetailView" bundle:nil];
        [self updateList];
        
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}



#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    
   
    // Do any additional setup after loading the view from its nib.
    //[source addObjectsFromArray:[UDdelegate naturArray]];
    
}

- (void)viewDidUnload
{

    [self setTabel:nil];
    [super viewDidUnload];
    
    self.dataSourceArray = nil; // this will release and set to nil
    source = nil;
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    NSLog(@"unload");
}
- (void)viewDidAppear:(BOOL)animated
{
    
    [super viewDidAppear:animated];
    
    [self updateList];
    
}

- (void)viewDidDisappear:(BOOL)animated
{
    
    [super viewDidDisappear:animated];
   
    
    
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

// to determine specific row height for each cell, override this.

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return ([indexPath row] == 0) ? 60.0 : 60.0;
}

// to determine which UITableViewCell to be used on a given row.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    //return [UDdelegate naturArray].count;
    return [source count];
}
//
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }

    _poi = [source objectAtIndex:indexPath.row];

    cell.textLabel.text = [_poi title];
    cell.detailTextLabel.text = [NSString stringWithFormat:@"Afstand: %f m.", [_poi dist]];
  //[cell.imageView setImage:<#(UIImage *)#>];
    
    return cell;
}
#pragma mark -
#pragma mark UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    _poi = [source objectAtIndex:indexPath.row];
    NSLog(@"%@",[_poi title]);
    
    NSString* u = [self parseURL:[_poi webUrl]];
    
        
    
    [_webView setIncUrl:u];
   
    [[self navigationController] pushViewController:_webView animated:YES];
       
}

-(NSString*)parseURL:(NSString*)url{
 
    
    NSString* s = [url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
   
    return s;
    
}


-(void)updateList{
    
    [source removeAllObjects];
    
    [source addObjectsFromArray:[UDdelegate naturArray]];
    
    [_tabel reloadData];
        
}

-(UIImage*)setImgFromUrl:(NSString*)url{
    
    NSURL *newurl = [NSURL URLWithString: url];
    
    
    UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL: newurl]];

    return image;
    
}

When the location is fetched the updateList method is called from the AppDelegate.m

  • 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-01T00:48:31+00:00Added an answer on June 1, 2026 at 12:48 am

    Turned out that it was just me who was a little impatient. the [_tabel reloadData] method is just a little “heavy” to call, so the list was in fact updated, but it just took a little while to update.

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

Sidebar

Related Questions

I have an array of different type objects and I use a BinaryWriter to
I have an array called $results, when I use function: print_r($results); I get the
I'm using java generics and varargs. If I use the following code, I'll get
I have a class that I use to setup objects in an array. In
I have the following ember.js code: app.js: Game = Ember.Application.create({ ready: function() { Game.gameController.getChallenge();
I have the following code that decodes a JSON string into an array of
I use this code to get a String array of headings used in a
I have a php multidimensional array populated from a table using the following code:
I have an array of objects which populate a UITableView . When a user
I have an Array of Objects that need the duplicates removed/filtered. I was going

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.