ECSlidingViewController freezes UIRefreshControl

576 views Asked by At

I'm using ECSlidingViewController in my app. I have a View Controller with a UITableView in it, which uses a UIRefreshControl to execute a long task. When I pull down to refresh, the refresh control starts animating normally but when I go to the top view controller (my main menu in this case) and then go back to my view controller, the refreshControl freezes completely until the task is completed.

To make it clearer, these are the steps I follow:

  1. Pull down my tableView to refresh it.
  2. A long task is executed on background, like:

    - (void)pulledToRefresh:(UIRefreshControl *)refreshControl
    {
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
            long long a = 0;
            for (long long i = 0; i < 100000000000; i++) {
                a++;
            }
            dispatch_async(dispatch_get_main_queue(), ^{
                [refreshControl endRefreshing];
            });
        });
    }
    
  3. While the refresh control is animating, I slide (I don't call the resetTopView:animated: method or any of those ones, I just make a pan gesture) my current view controller to the right to show my Main Menu. When this happens, the refresh control suddenly stops animating (it freezes).

  4. I go back to the view controller I was using at first but it remains frozen.

  5. The task completes and the refresh control ends the refresh naturally, removing itself from my tableView with a nice animation.

Any idea why this happens?

1

There are 1 answers

0
rordulu On

I may have found a solution for this.... Changing the "detectPanGestureRecognizer" method to below, seems to be working for me...

- (void)detectPanGestureRecognizer:(UIPanGestureRecognizer *)recognizer {
if (recognizer.state == UIGestureRecognizerStateBegan) {
    _isInteractive = YES;
}
dispatch_async(dispatch_get_main_queue(), ^{
    [self.defaultInteractiveTransition updateTopViewHorizontalCenterWithRecognizer:recognizer];
});
_isInteractive = NO;

}