Centering an NSImageView in a scroller
Centering an NSImageView in a scroller
- Subject: Centering an NSImageView in a scroller
- From: Timothy Larkin <email@hidden>
- Date: Thu, 21 Feb 2002 19:59:35 -0500
My application displays jpegs in an NSImageView. The image view is inside an
NSScrollView. My idea is that when the clip view is smaller than the image,
the user can scroll around the image using the scroll bars. When the clip is
larger than the image because the user enlarges the window, the scroll bars
go away, but the image's position is adjusted so that it appears in the
center of the clip view. Everything works as expected, except the last part.
I cannot get the image view to appear anywhere except with its origin at the
origin of the clip view, ie, the lower left corner.
Having perused the NSView documentation, it seems that I should be able to
move the image around in the clip view by changing the origin of the image's
frame. Curiously, the position of the frame has no effect on the position of
the image view. I tried changing the position of the bounds rectangle, but
this also had no effect on the position of the image view.
This has had me puzzled for several days. Either I've misconstrued something
about the way that nested views work, or NSImageView behaves in a way which
is inconsistent with the documentation.
--
Timothy Larkin
Abstract Tools
Caroline, NY
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.