UIScrollView does not scroll

Discussion in 'iOS Programming' started by portem1, Jan 18, 2011.

  1. macrumors newbie

    Joined:
    Jan 18, 2011
    #1
    Hello,

    I have an UIScrollView that I fill dynamically with UILabels.
    At the end I need to allow scrolling if the contents are larger than the containing view.
    I try to do this with:
    scrollhowtouse.frame=CGRectMake(0,0,320, yf);
    where yf is the end position calculated by my program.
    But doing so just displays the full screen and scrolling is not possible.

    What point do I miss here?

    Thanks for your answers
     
  2. macrumors regular

    Joined:
    Jan 13, 2011
    #2
    A lot of factors left out to fully know why the problem is. Is yf defined before that line is executed? Is 0, 0, and 320 already initialized?
     
  3. thread starter macrumors newbie

    Joined:
    Jan 18, 2011
    #3
    Yes, 0, 0, 320 is already initialized
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    The UIScrollView should be sized to the screen/space you want it in (this is the frame). The UIScrollViews contentSize property should be set to the size of the content view. If the contentSize is larger than the frame (and scrolling is enabled) then you can scroll the content.
     
  5. thread starter macrumors newbie

    Joined:
    Jan 18, 2011
    #5
    Thanks, i did like you said and it works!
     

Share This Page