当我单击表格单元格时,在加载下一个视图之前会有 1-2 秒的短暂延迟。我见过一些应用程序在那段时间显示活动指示器,这就是我想做的。我添加了一个这样的
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
spinner.frame = CGRectMake(200,200,200,200);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.accessoryView = spinner;
[spinner startAnimating];
[spinner release];
VenueViewController *vviewcontroller = [[VenueViewController alloc] initWithNibName:@"VenueViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:vviewcontroller animated:YES];
[vviewcontroller release];
vviewcontroller = nil;}
然而,这也会延迟出现,就在下一个视图显示之前。单击表格单元格后,该应用程序似乎冻结了 1-2 秒,因此它甚至不显示活动指示器。