我的桌子有问题。加载完所有内容后我的数据正在加载并串入名称和loadscore。但它不会显示在表格中。请帮忙。没有数据显示的空表
static const NSInteger kNameLabelTag = 1337;
static const NSInteger kScoreLabelTag = 5555;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UILabel *nameLabel = [[UILabel new] autorelease];
[nameLabel setTag:kNameLabelTag];
[cell.contentView addSubview:nameLabel];
UILabel *highscoreLabel = [[UILabel new] autorelease];
[highscoreLabel setTag:kScoreLabelTag];
[cell.contentView addSubview:highscoreLabel];
}
// Configure the cell.
//cell.textLabel.text = [loadhighScore objectAtIndex:indexPath.row];
NSDictionary *score = [self.loadhighScore objectAtIndex:indexPath.row];
NSString *name = [score objectForKey:@"ScoreName"];
NSString *loadscore = [score objectForKey:@"HighScore"];
[(UILabel *)[cell.contentView viewWithTag:kNameLabelTag] setText:name];
[(UILabel *)[cell.contentView viewWithTag:kScoreLabelTag] setText:loadscore];
return cell;
}
考虑改变你的初始[问题](http://stackoverflow.com/questions/4359786/how-do-i-display-the-data-saved-in-table),而不是发布一个新的同一主题 – vikingosegundo 2010-12-05 20:35:04