【发布时间】:2011-09-12 20:07:56
【问题描述】:
如何一次从 UITableView 中删除所有行? 因为当我用新数据重新加载表视图时,我仍在插入新行:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CustomTableViewCell *cell = (CustomTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[CustomTableViewCell alloc] initWithFrame:CGRectZero] autorelease];
}
//... setting the new cell here ...
return cell;
}
谢谢。
【问题讨论】:
-
从数组中删除所有对象。更新 tableView,然后添加新数据。
标签: objective-c uitableview uikit