0

我偶尔会从 NSMetadataQueryDidUpdateNotification 获取更新。这些在后台异步线程中运行,但仍然偶尔会减慢应用程序的速度。

问题是这会减慢我的 TableView 速度,以至于如果您单击一行,它有时不会立即推动它。这是 tableView 内部的一个简单调用:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

[[self navigationController] pushViewController:detailViewController animated:YES];
[detailViewController release];

如果您多次触摸该行(沮丧),应用程序视图控制器堆栈就会混乱:

nested push animation can result in corrupted navigation bar
nested push animation can result in corrupted navigation bar
nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Unbalanced calls to begin/end appearance transitions for <DetailViewController: 0xdabc0c0>

我如何阻止这种情况发生并且只接受对行的第一次触摸?

4

1 回答 1

0

我现在已经部分解决了这个问题。我尝试使用:

[self.view setUserInteractionEnabled:NO];

在我的添加按钮方法和 tableView didSelectRowAtIndexPath 但它没有解决多次按下问题。所以我不得不单独禁用它们:

添加按钮的创建:

    UIBarButtonItem *bbi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addNew:)];
    self.addBtn = bbi;
    [[self navigationItem] setRightBarButtonItem:bbi];

在我的 addNew: 方法的开头

[self.addBtn setEnabled:NO];

在我的 tableView didSelectRowAtIndexPath 方法的开头

[self.myTable setAllowsSelection:NO];

在视图中会出现:

[self.addBtn setEnabled:YES];
[self.myTable setAllowsSelection:YES];
于 2012-05-03T18:06:07.607 回答