UITableViewCell选择故事板segue很慢 - 虽然双击是有效的 [英] UITableViewCell selection Storyboard segue is slow - double tapping works though

查看:97
本文介绍了UITableViewCell选择故事板segue很慢 - 虽然双击是有效的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Storyboard中有一个UITableViewController。我选择了我的UITableViewCell原型,触发了一个segue来呈现另一个控制器。演示文稿本身正在运作。

I have a UITableViewController in a Storyboard. I have the selection of my UITableViewCell prototype trigger a segue to present another controller. The presentation itself is working.

我注意到一个奇怪的错误(可能在iOS 8中引入),点击单元格按预期突出显示单元格,但有时需要几秒钟才能执行segue。点击单元格两次会导致segue立即发生。

I noticed a strange bug (possibly introduced in iOS 8) that tapping on the cell highlights the cell as expected but sometimes takes several seconds before performing the segue. Tapping on the cell twice causes the segue to happen immediately.

有没有人在iOS 8中注意到这一点?

Has anyone else noticed this in iOS 8?

编辑:我现在已经注意到,它不仅仅是一个双击,更快地触发segue。它也可以点击单元格,然后在任何地方轻扫。开始对我来说似乎是一个线程问题...

I've now noticed that it is not just a double tap that triggers the segue faster. It is also a tap on the cell followed by a swipe anywhere. Starting to seem like a threading issue to me...

推荐答案

在我的情况下,解决方案最终要调用<$使用GCD在主队列上手动从 didSelectRow 手动c $ c> performSegue 而不是使用 UITableViewCell 故事板中的选择插座。

In my case, the solution ended up being to call performSegue manually from didSelectRow on the main queue using GCD instead of using the UITableViewCell selection outlet in Storyboard.

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  dispatch_async(dispatch_get_main_queue(), ^{
    [self performSegueWithIdentifier:kShowDetailSegue
                          sender:nil];
  });
}

我不确定为什么这有必要 - 当然你认为Storyboard中的选择出口将在主队列上运行,但可能是iOS 8错误。

I'm not sure why this became necessary- certainly you'd think that the selection outlet in Storyboard would operate on the main queue, but maybe it is an iOS 8 bug.

这篇关于UITableViewCell选择故事板segue很慢 - 虽然双击是有效的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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