Re: Scroll View
Re: Scroll View
- Subject: Re: Scroll View
- From: Tim McLaren <email@hidden>
- Date: Fri, 19 Oct 2001 14:38:29 +1000
Try setting the frameRect of the image view to the size of the image.
This will cause the NCClipView to be updated with the new size.
I'm having some trouble getting my scroll view to work properly.
After reading all the documentation (NSView, NSScrollView,
NSClipView), I'm afraid I'm just not understanding the heirarchy of
subviews well enough to determine what I need to set.
I have an image view which sits inside of a scroll view. When I
open an image, I want the image view to equal the size of the image.
I then want to scroll view so that the upper left part of the image
is in the upper left corner of the displayed rect. I was able to
get the image to scroll to the proper position, but I'm having
trouble getting the content of the scroll view to be limited to the
size of the image...in other words, you can scroll down and right
far beyond the bottom rightmost corner of the image, which is what I
want to prevent.
Here is the (some hasty) code I've got so far: (this code is right
after the open panel sheet returns from the user selecting what
image to open)
NSPoint thePoint = {0,0};
path = [sheet filename];
originalImage = [[NSImage alloc] initWithContentsOfFile: path];
[mainImageView setImage: originalImage];
thePoint.y = [mainImageView bounds].size.height;
[mainImageView scrollPoint:thePoint ];
Any help on this is greatly appreciated.
Spencer
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
--