• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Centering an NSImageView in a scroller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Cocoa newbie - document-based Cocoa app with OpenGL
  • Next by Date: Distributed Objects
  • Previous by thread: Re: Cocoa newbie - document-based Cocoa app with OpenGL
  • Next by thread: Getting an instance of NSOutlineView (Java)
  • Index(es):
    • Date
    • Thread