On Aug 20, 2010, at 10:54, Brian Postow wrote:

> I just discovered     [imageView setImageAlignment: ] which, as long as the 
> imageView is bigger than the scrollview, does the correct thing (Lock the 
> image to the upper left corner of the scrollView). However, when the 
> imageView is smaller than the scrollview, The imageView is still locked to 
> the bottom left of the scrollview, but the image is locked to the top left of 
> the imageview. 

The image view's image alignment is irrelevant to scrolling. Scrolling relates 
entirely and exclusively to the geometric relationship between the document 
view and the content view. (You say "scrollview", but I think you really mean 
the content view.) Moving the image around within the image view does something 
that looks a little bit like scrolling, but isn't -- the scroll bars wouldn't 
match the part of the image you can see.

If the image view is smaller than the content view, another can of worms gets 
opened up. It should be possible to put the image view in the center of the 
content view, or at its top left, which should mean it's surrounded by the 
scroll view's background color. But then you can't do any drawing outside of 
the image view, which kind of feels wrong when you're trying to drag out a 
selection rectangle. So in fact what I usually do is keep the document view at 
least as large as the content view, even if its "canvas" is a smaller area 
within it. That effectively divorces both the scale and the position of the 
image area from the view, something that NSImageView can't actually do.

> Setting the Scrollview boundsOrigin, the imageView bounds origin and 
> translating the origin of the imageview or the scrollview had absolutely no 
> effect. 

It's not the scroll view that's relevant, but the content (clip) view. I think 
setting the clip view bounds origin works, or scrollToPoint:, but [imageView 
setFrame:] is probably the easiest way.

I feel like I keep confusing matters rather than clarifying them, so I 
apologize for that, but I also think the trouble you're having comes from 
clinging to NSImageView. If you'd let go of that, I suspect things will fall 
into place fairly easily.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to