I'd like very much to temporarily highlight a UITableViewCell to draw attention to the fact that the containing data has changed.
there is a UITableViewCell method: -setHighlighted:(BOOL) animated:(BOOL) but I can't make it do anything?
Here is the relevant part of the view controller:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
switch (indexPath.section) {
case 0: {
if (indexPath.row == 0) {
cell = [[UITableViewCell alloc ] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"currentLoc"];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.text = @"This is the special cell";
}
[cell setHighlighted:YES animated:YES];
[cell setHighlighted:NO animated:YES];
//[cell setNeedsDisplay];
} else {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"setLocAutomatically"];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.text = @"Foo";
}
} break;
case 1: {
cell = [[UITableViewCell alloc ] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"selectCity"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
if (indexPath.row == 0) {
cell.textLabel.text = @"Select a Bar";
} else {
cell.textLabel.text = @"Select a Baz";
}
} break;
}
[cell autorelease];
return cell;
}
See the [cell setHighlight...] above for my attempt.
Much to my frustration, the cell doesn't highlight and I haven't figured out any way to make it work.
Thank you,
Carl C-M