0

我在任何应用程序中看到表格视图单元格选择突出显示在转换到其他视图之前非常平滑地消失。我已经搜索过这个主题,但我没有找到任何例子。

谢谢

4

1 回答 1

1

您可以像这样实现您描述的效果。


-(void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tv deselectRowAtIndexPath:indexPath animated:YES];
    double delayInSeconds = .3;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        Location *loc = [self.locations objectAtIndex:indexPath.row];
        LocationDetailsController *locationDetails = [[[LocationDetailsController alloc] initWithNibName:nil bundle:nil] autorelease];
        locationDetails.location = loc;
        [self.navigationController pushViewController:locationDetails animated:YES];
    });
}

于 2012-05-04T18:39:18.240 回答