UITableView didSelectRowatIndexPath 未在单击时调用 [英] UITableView didSelectRowatIndexPath not called on single tap

查看:29
本文介绍了UITableView didSelectRowatIndexPath 未在单击时调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

非常非常奇怪!它适用于任何地方,但在这里:

Very very strange! It works everywhere but here:

- (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];
}

如果我单击该行,则 MyViewController 会在几秒钟后显示!如果我单击两次,它会迅速显示!在 Profiler 中,单击一下什么也没有发生...我没有 didDeselectRowAtIndexPath 方法.

If I tap by a single click on the row, the MyViewController shows after seconds! If I click twice, it shows rapidly! In the Profiler, at single click nothing happens... I have no didDeselectRowAtIndexPath method.

推荐答案

解决办法是把第二个控制器的加载放在主线程上

The solution is to put on the main thread the loading of the second controller

 dispatch_async(dispatch_get_main_queue(), ^{ 
       // Code here 
 });

这篇关于UITableView didSelectRowatIndexPath 未在单击时调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆