0

我有一个 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;
}
4

1 回答 1

0

创建专用参考

@property(nonatomic, retain) IBOutlet UITableView *tableViewReference;

在注销方法中重新加载该引用。

于 2012-12-01T08:00:22.507 回答