0

我有一个 UITableView,我刚刚在其中插入了一个新行,检索了该行的 NSIndexPath,然后滚动到它。如何使该行的单元格短暂闪烁?

int indexOfRow = //retrieve row index
NSIndexPath *indexPath =  [NSIndexPath indexPathForRow:indexOfRow inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
//cause cell to blink

接下来是什么?

4

2 回答 2

0

干得好:

UITableViewCell *tableCell = [[self tableView] cellForRowAtIndexPath:indexPath];
[tableCell setHighlighted:YES animated:NO];
[tableCell setHighlighted:NO animated:YES];
于 2012-10-01T16:14:36.647 回答
0

尝试这个:

- (void) someMethod {
    //your other code
    //...

    UITableViewCell *tableCell = [[self tableView] cellForRowAtIndexPath:indexPath];
    [tableCell setHighlighted:YES animated:NO];
    [self performSelector:@selector(completeCellBlink:) withObject:tableCell afterDelay:0.2];

}

- (void) completeCellBlink: (UITableViewCell*) cell {
    [tableCell setHighlighted:NO animated:YES];
}

延迟以秒为单位,您当然可以更改该值以调整视觉印象。

于 2012-11-12T13:17:56.307 回答