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