Ok, so I dragged a Scroll View (NSScrollView) into my IB window, selected the inner NSView, and changed its class to a custom class (which I named "MapView").
I also made a button that scrolls the map upwards (northwards) by 20 pixels.
The button works fine, but the vertical scrollbar, of course, doesn't update. I know I need to use reflectScrolledClipView to do that.
But I'm totally confused...
From inside the "moveNorth" method of the MapView class, how do I call it?
[scrollView reflectScrolledClipView:self]; ???
[scrollView reflectScrolledClipView:[scrollView contentView]]; ???
[self reflectScrolledClipView:[scrollView contentView]]; ???
None of those seem to work.
My problem is I don't understand what the docs mean when they mention "aClipView". Is the clip view the view inside the scrollbar (aka MapView)? Or is it another view that's inside the Scroll View that contains MapView?
Here's my scrollNorth method (as it is now):
Also, by using setBoundsOrigin, the map "jumps" 20 pixels, is there a single command that will make it smoothly scroll those 20 pixels?
Thanks for any help you can give - even if just a hint or two...
Greg
I also made a button that scrolls the map upwards (northwards) by 20 pixels.
The button works fine, but the vertical scrollbar, of course, doesn't update. I know I need to use reflectScrolledClipView to do that.
But I'm totally confused...
From inside the "moveNorth" method of the MapView class, how do I call it?
[scrollView reflectScrolledClipView:self]; ???
[scrollView reflectScrolledClipView:[scrollView contentView]]; ???
[self reflectScrolledClipView:[scrollView contentView]]; ???
None of those seem to work.
My problem is I don't understand what the docs mean when they mention "aClipView". Is the clip view the view inside the scrollbar (aka MapView)? Or is it another view that's inside the Scroll View that contains MapView?
Here's my scrollNorth method (as it is now):
Code:
- (void)scrollNorth
{
NSRect bounds = [self bounds];
[self setBoundsOrigin:NSMakePoint(bounds.origin.x, bounds.origin.y + 20)];
NSView *scrollView = [self enclosingScrollView];
[scrollView reflectScrolledClipView:self];
}
Also, by using setBoundsOrigin, the map "jumps" 20 pixels, is there a single command that will make it smoothly scroll those 20 pixels?
Thanks for any help you can give - even if just a hint or two...
Greg