Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's what I've been using:</p> <p>First of all you have a view holding the "Pull up to refresh message", and assign it to:</p> <pre><code>[pullUpView setFrame:CGRectMake(0, [tableView rectForFooterInSection:0].origin.y, [tableView bounds].size.width,pullUpView.frame.height)]; </code></pre> <p>Then you setup two delegate methods as below to track the dragging.</p> <pre><code>- (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView.isDragging) { CGFloat thresholdToRelease = [pullUpView frame].origin.y - [scrollView bounds].size.height; CGFloat thresholdToLoad = thresholdToRelease + [pullUpView frame].size.height; if (([scrollView contentOffset].y &gt;= thresholdToRelease) &amp;&amp; ([scrollView contentOffset].y &lt; thresholdToLoad)) { [pullUpView reset]; } else if ([scrollView contentOffset].y &gt;= thresholdToLoad) { [pullUpView indicateThresholdRearched]; } } } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { CGFloat thresholdToAction = [pullUpView frame].origin.y + [pullUpView frame].size.height - [scrollView bounds].size.height; if ([scrollView contentOffset].y &gt;= thresholdToAction) { if (!performingAction) { [pullUpView startLoading]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.5]; [tableView setContentInset:UIEdgeInsetsMake(0, 0, [pullUpView frame].size.height, 0)]; [UIView commitAnimations]; /* do your things here */ performingAction = YES; } } } </code></pre> <p>At the end revert the tableView's contentInset to hide the pullUpView.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload