Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
582 views
in Technique[技术] by (71.8m points)

objective c - UITableViewCell selection Storyboard segue is slow - double tapping works though

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.

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.

Has anyone else noticed this in iOS 8?

EDIT: 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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...