单击时未调用UITableView didSelectRowatIndexPath

giu*_*ppe 4 uitableview ios

非常奇怪!它适用于所有地方但在这里

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{
 MyViewController* cliente = [[MyViewController alloc] initWithModeAndClientId:2 c:cid];

            cliente.delegate                    = self;
            UINavigationController *n = [[UINavigationController alloc] initWithRootViewController:cliente];

            n.navigationBarHidden     = NO;
            [[n navigationBar] setBarStyle:UIBarStyleBlack];
            [self presentViewController:n animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

如果我点击该行点击一下,MyViewController几秒钟后即可显示!如果我点击两次,它会迅速显示!在Profiler中,单击没有任何反应......我没有didDeselectRowAtIndexPath方法.

giu*_*ppe 6

解决方案是在主线程上加载第二个控制器

 dispatch_async(dispatch_get_main_queue(), ^{ 
       // Code here 
 });
Run Code Online (Sandbox Code Playgroud)

  • 好吧,我想 didSelect 在主线程上。它怎么可能在不同的线程上? (2认同)