Jared Aaron Loo
Jared Aaron Loo

Reputation: 678

self.tableView reloadData doesnt reload UITableView

I've been trying to reload my UITableView but to no avail. The code for my viewWillAppear looks like this:

-(void)viewWillAppear:(BOOL)animated {
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh  target:self action:@selector(refresh)] autorelease];
    [super viewWillAppear:animated];
    [self.tableView reloadData];
}

The code for my refresh method:

-(void)refresh{
    NSLog(@"refreshing UITableView!");
    [self.tableView reloadData];
}

Any help is very much appreciated!

Upvotes: 0

Views: 8164

Answers (2)

iiFreeman
iiFreeman

Reputation: 5175

Think the reason is you loosing pointer to your UITableView. Make sure that you UITableView @property is strong (retain) and check maybe you receiving memory warning and all your IBOutlets removing. Before you made reloadData try to:

NSLog(@"%@", self.tableView);

make sure that it's not nil.

Upvotes: 1

Jared Aaron Loo
Jared Aaron Loo

Reputation: 678

Found it, to get an updated list, it was necessary to call the viewdidLoad method again, in addition to the self.tableView reloaddata.

Upvotes: 1

Related Questions