Delay after didSelectRowAtIndexPath Delay after didSelectRowAtIndexPath swift swift

Delay after didSelectRowAtIndexPath


I have the same problem and it seems that this is a bug of iOS. Solved with the following solution.

dispatch_after(dispatch_time(DISPATCH_TIME_NOW,     Int64(0 * Double(NSEC_PER_SEC))),     dispatch_get_main_queue()) { () -> Void in        self.presentViewController(personViewController, animated: true,completion: nil)    }

Swift3 version:

DispatchQueue.main.async {    self.presentViewController(personViewController, animated: true,completion: nil)}


Maybe you will call the method

[tableView deselectRowAtIndexPath:indexPath animated:NO];

before Push ViewController or Other Operation. Like

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {    // 1. manual call this method to deSelect Other Cell    [tableView deselectRowAtIndexPath:indexPath animated:NO];    // 2. than do other operation    PushViewController Or Some Animation ....}

that`s solve my problem . when i custom transition viewController for Model Style


You are loading two images and instantiating a view controller from the storyboard after someone taps on a cell. This involves a heavy process, and can take time depending on how complicated your view controller is, and how big those images are.

Now you could either move your image loading code to viewDidAppear() or maybe load the images asynchronously and then assign them.


Another way could be to use imageWithContentsOfFile: to load the images. Apparently this method is faster and uses less memory.

NSString *file = [[NSBundle mainBundle] pathForResource:@"image_name" ofType:@"jpg"];UIImage *currentImage = [UIImage imageWithContentsOfFile:file];