ビューベースのアプリに配置される 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;
}