Я бы очень хотел временно выделить UITableViewCell, чтобы обратить внимание на то, что содержащиеся данные изменились.Как я могу выделить UITableViewCell
есть метод UITableViewCell: -setHighlighted: (BOOL) анимированный: (BOOL), но я не могу заставить его ничего делать?
Вот соответствующая часть контроллера представления:
- (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;
}
см [клеточную setHighlight ...] выше моей попытки.
К большому разочарованию, ячейка не выделяет, и я не понял, каким образом заставить ее работать.
Спасибо,
Carl C-M
Это работал для меня, и должно быть принятый ответ, imo. –
тоже работал для меня – z22