iOS.Performance-trick-presentViewController-is-so-slow-in-didSelectRowAtIndexPath

presentViewController is so slow in "tableView:didSelectRowAtIndexPath:"

Use Case: 在UITableView的delegate方法"tableView:didSelectRowAtIndexPath:"中调用

"[UIViewController presentViewController]"发现被显示的ViewController要有很长的延迟

才会显示出来。

修改后:

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

    NSInteger rowInSection = indexPath.row;
switch (rowInSection) {
case : // age
{
dispatch_async(dispatch_get_main_queue(), ^{
NSDate * nowDate = [NSDate date];
QZDatePickerViewController * datePickerViewController = [[QZDatePickerViewController alloc] initWithDate:nowDate];
datePickerViewController.delegate = self;
[self presentViewController:datePickerViewController
animated:NO
completion:nil];
}); }
break;
}

Reference

1. presentViewController:animated:YES view will not appear until user taps again

http://*.com/questions/21075540/presentviewcontrolleranimatedyes-view-will-not-appear-until-user-taps-again

上一篇:Ubuntu16.04安装搜狗拼音输入法(中文输入法)


下一篇:js获取节点和编辑的方法