我有一个 UITableView 放在基于视图的应用程序上。它已正确连接,因为我最初可以向它发送数据。问题是清理桌子。我可以清除 NSMutableArray 但数据仍显示在表中。
-(void)logout {
NSLog(@"LOGOUT");
[friends removeAllObjects];
NSLog(@"%@", friends);
[tableView reloadData];
}
这是索引路径处的行单元格: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithFrame:CGRectZero];
}
// Set up the cell...
NSString *cellValue = [friends objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}