Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7412171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:30:03+00:00 2026-05-29T06:30:03+00:00

I have a UIView with content and I am implementing a pull-to-refresh feature. How

  • 0

I have a UIView with content and I am implementing a pull-to-refresh feature. How can I configure the UIScrollView to always bounce back to contentOffset of 0,0 (and make it look natural)?

I’ve seen plenty of examples of doing this with UITable View and have the pull to refresh behavior pretty down. My issue seems to be having a large content size to accomodate the hidden Pull-To-Refresh banner. If I scroll the content down, it will snap back up. If I pull the content up, it lazily scrolls back down but not to the same exact position.

I’ve implemented the below function, which will detect if the scroll view is scrolling. It will then reposition the view back to 0,0. This kind of works but looks jumpy or have lag in the animation.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
{
    if(moveScrollView)
        [moveScrollView invalidate];

moveScrollView = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(moveScrollViewToOrigin) userInfo:nil repeats:NO];
}

- (void)moveScrollViewToOrigin;
{    
    if(scrollView.contentOffset.y == 0)
        return;

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.2];
    [[self scrollView] setContentOffset:CGPointZero];
    [UIView commitAnimations];
}

I’ve created a sample project with the problem and my solution here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:30:04+00:00Added an answer on May 29, 2026 at 6:30 am

    The scrolling position seems to behave as expected when pulling content down. It’s when the screen initially loads, the pull-to-refresh banner is hidden on top, and you push content up. The content doesn’t always come back down as far as it should. Sometimes the offset of y is 40 when it’s finished bouncing. This is all verifiable by my sample code I posted.

    Since the problem is isolated to allowing contentOffset.y to be greater than zero I decided to disable that behavior. I placed the following in (void)scrollViewDidScroll:(UIScrollView *)scrollingView;

    if(scrollingView.contentOffset.y > 0){
        //content is moving up and the Refresh banner is already hidden
    
        //disable scrolling
        [[self scrollView] setScrollEnabled:NO];
    
        //move content back to origin, do not animate        
        CGRect originBounds = self.scrollView.bounds;
        originBounds.origin.y = 0.0f;
        [[self scrollView] scrollRectToVisible:originBounds animated:NO];
    
    }else
    {
        [[self scrollView] setScrollEnabled:YES];        
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIScrollView contained within a custom UIView with a content size larger
I have a UIView with a navigation bar. How can I hide the navigation
I have a UIScrollView subclass that I am programmatically scrolling using UIView animations. I'd
how to make a UIView added to UITableViewCell content view fit within its bounds?
I have a UIView that contains my UIScrollView (with a bunch of elements inside)
In my iPhone app I have a UIScrollView with custom content views. At some
Right now, I have a UIScrollView which scales its UIView contents on zoom events.
From top to bottom I have UIView, UIScrollView, a UIImage, a UILabel, a UITextView
I have this UIScrollView inside another UIView, not occuping the entire area (all this
I currently have a UIView / UIScrollView that is displayed within a modal view.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.