UITable View doesn't reload
I have a UITableView that is put onto a view based app. it is wired up properly because I can initially send it data. The problem is clearing the table. I can clear the NSMutableArray but the data still shows up in the table.
-(void)logout {
NSLog(@"LOGOUT");
[friends removeAllObjects];
NSLog(@"%@", friends);
[tableView reloadData];
}
and here is the cell for row at index path: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell 开发者_Python百科= [[UITableViewCell alloc] initWithFrame:CGRectZero];
}
// Set up the cell...
NSString *cellValue = [friends objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
Create a dedicated reference
@property(nonatomic, retain) IBOutlet UITableView *tableViewReference;
Reload that reference in the logout method.
精彩评论