How to know if I'm outside a ScrollView?

  • Hi all,

    I have a view embedded in a ScrollView. The thing is that I'm operating in
    that view with the keyboard (actually pressing the up and down arroy keys)
    so I would like the superview (the scrollview) to scroll when I get off
    bounds the visible rect. I've searched around the web but found nothing.
    Does anyone knows how to do it?

    Many thanks to all,

    Guillem
  • Dont know if I get you right but..
    you can use [scrollview visibleRect] to see whats on screen
    and scrollToRect/Point to modify scrollbar

    so.
    if after downKey is pressed
      selectedItem.frame is not in scrollView.visibleRect
    {
      scrollView.scrollToRect: selectedItem.frame
    }

    :)
    Where you could skip the check so just:
      scrollView.scrollToRect: selectedItem.frame

    Regards,
    Dominik
    On Feb 16, 2008, at 12:14 PM, Guillem Palou wrote:

    > Hi all,
    >
    > I have a view embedded in a ScrollView. The thing is that I'm
    > operating in
    > that view with the keyboard (actually pressing the up and down arroy
    > keys)
    > so I would like the superview (the scrollview) to scroll when I get
    > off
    > bounds the visible rect. I've searched around the web but found
    > nothing.
    > Does anyone knows how to do it?
    >
    > Many thanks to all,
    >
    > Guillem
previous month february 2008 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29    
Go to today