Caching issues with TDBadgedCell
Posted
by Wolfgang Schreurs
on Stack Overflow
See other posts from Stack Overflow
or by Wolfgang Schreurs
Published on 2010-02-06T22:57:06Z
Indexed on
2010/06/16
10:02 UTC
Read the original article
Hit count: 294
uitableview
|uitableviewcell
This post is closely related to my previous post: http://stackoverflow.com/questions/2201256/tdbadgedcell-keeps-caching-the-badgenumber
The "badge" from TDBadgedCell keeps caching the numbers. A very simple example is shown here:
- (UITableViewCell *)tableView:(UITableView *)_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
TDBadgedCell *cell = (TDBadgedCell *)[_tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
[cell setBadgeColor:[UIColor blackColor]];
[cell setBadgeNumber:[indexPath row]];
[[cell textLabel] setText:[NSString stringWithFormat:%@"%d", [indexPath row]]];
return cell;
}
Anyone has any clue why this happens? The textLabel and detailTextLabel don't cache the data. Any additonal info would be welcome as well, as I seem to have a lot of issues with the caching of graphics in UITableViewCells. Any best practices or other useful information would be most welcome.
© Stack Overflow or respective owner