0

I have an issue with my UIRefreshControl : after the first time it was triggered, it cancels touch on top of my first custom cell (even if it is hidden), like if it was invisible. If I remove it from superview, then add it again, the issue is still there.

Actually I have a UITableView that is populated with some data. The user can refresh the table view by pulling it and for that I've added an UIRefreshControl to my table view like this in viewDidLoad()

self.refreshControl = [[UIRefreshControl alloc]init];
self.refreshControl.tintColor = [UIColor colorWithRed:0.35 green:0.78 blue:0.98 alpha:1.0];
[_tableView addSubview:self.refreshControl];

I've not added selector to the refreshControl object because I want the tableView to refresh only when the user stopped touching the screen. So for that I've added this ScrollView's delegate method :

- (void)scrollViewDidEndDecelerating:(UIScrollView*)scrollView {

    if (self.refreshControl.isRefreshing) {

        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

            dispatch_sync(dispatch_get_main_queue(), ^{

                [self refreshTable];

            });

        });

    }

}

And here is my refresh method :

- (void)refreshTable {

    //refresh code

    [self.refreshControl endRefreshing];

}

I don't want to put my app online with this issue, even if this does not block user to use it !

Thanks in advance for your help !

batman
  • 1,937
  • 2
  • 22
  • 41
Synny
  • 542
  • 1
  • 4
  • 18
  • What do you mean by `because I want the tableView to refresh only`? you would refresh by dragging the UITableView only, whats the point doing it through scrollview delegate? – iphonic Aug 08 '16 at 12:02
  • @iphoniclike it was said, " I want the tableView to refresh only when the user stop touching the screen". If I don't do that way (I mean if I add a selector), the reloadData won't wait that the user stop touching the screen. Is there any way to do this without ScrollView's delegate ? – Synny Aug 08 '16 at 12:35

1 Answers1

0

I've found the solution by going to this post

So effectively in my case I did not have to add a selector, just implement those UIScrollViewDelegate's method :)

Community
  • 1
  • 1
Synny
  • 542
  • 1
  • 4
  • 18