这是cellForRowAtIndexPath:方法的代码。为什么[self.tableView reloadData]不起作用?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if (cell == nil) { cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [array objectAtIndex:row];
return cell;
}
当我使用[self.tableView reloadData];
什么都没有发生?
很少Q ?:这个类是UITableViewController的子类吗?在调用[self.tableView reloadData]之前使用新值更新数组; – Hanuman 2011-03-18 07:32:06
不,是我做的.. – mamrezo 2011-03-18 07:39:23