UIScrollView strange behaviour

Discussion in 'iOS Development' started by johnmabassa, Jun 30, 2009.

  1. johnmabassa

    johnmabassa Member

    Joined:
    Mar 16, 2009
    Messages:
    87
    Likes Received:
    0
    Hi,
    I have a UIScrollView on a UIView whose contentSize is set to (320,600). i have list of colors in it. The problem is that, if I scroll to the end of the list and then go back to some other page and then again come back to the scrollView, the page still remains at the bottom of the list. I want the content to be shown from the beginning when each time the user enters that screen. I have almost played with the different properties available along with UIScrollView but no results. Any way to do this?

    -John
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    That means that you're always hanging onto that view that contains the scrollview. No problem, if memory isn't tight in your app. To scroll back to the top (or wherever), just reset the contentOffset of the scrollview to wherever you want it.
  3. johnmabassa

    johnmabassa Member

    Joined:
    Mar 16, 2009
    Messages:
    87
    Likes Received:
    0
    I just set the contentOffset to CGPointZero and it worked fine. Thanks for the info.

    -John

Share This Page