iPhone: UITableView not Displaying New Data After Call to reloadData
Posted
by donnib
on Stack Overflow
See other posts from Stack Overflow
or by donnib
Published on 2010-05-12T20:55:46Z
Indexed on
2010/05/12
22:14 UTC
Read the original article
Hit count: 362
My problem is that the cell.textLabel does not display the new data following a reload. I can see the cellForRowAtIndexPath
being called so I know the reloadData
call goes thru. If I log the rowString
I see the correct value so the string I set label text to is correct. What am I doing wrong?
I have following code :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
static NSString *RowListCellIdentifier = @"RowListCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RowListCellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RowListCellIdentifier]autorelease];
}
NSMutableString *rowString = [[NSMutableString alloc] init];
[rowString appendString:[[[rows objectAtIndex:row] firstNumber]stringValue]];
[rowString appendString:@" : "];
[rowString appendString:[[[rows objectAtIndex:row] secondNumber]stringValue]];
[rowString appendString:@" : "];
[[cell textLabel] setText:rowString];
[rowString release];
return cell;
}
- (void)viewWillAppear:(BOOL)animated {
[self.tableView reloadData];
[super viewWillAppear:animated];
}
© Stack Overflow or respective owner