• 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
Re: Centering a view in an NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Centering a view in an NSScrollView


  • Subject: Re: Centering a view in an NSScrollView
  • From: Christopher B Hamlin <email@hidden>
  • Date: Sun, 20 Jan 2002 02:00:29 -0500

On Saturday, January 19, 2002, at 10:32 PM, Dustin Mierau wrote:

I have a view in an NSScrollView, when the contentSize of the scrollview is larger than my view I want my view to appear centered within the scrollview, even as the scrollview is being resized. Right now it is tagged to the bottom left. I know I can return YES from the isFlipped method to tag it to the top left, but like I said, I want it centered. There does not seem to be a good way to do this, any ideas?



I had to work through something similar (zooming in/out in an NSScrollView
on the visible center). If you want to know how to do that, I can tell
you for sure.

For this, off the top of my head, you might be able to keep track of the
contentView's bounds and adjust for any changes in size by moving
the origin. If you NSLog the contentView's bounds in your drawRect you
might be able to figure out how to keep things centered.


Regards,

Chris Hamlin


  • Follow-Ups:
    • Magnification cursor
      • From: Dustin Mierau <email@hidden>
References: 
 >Centering a view in an NSScrollView (From: Dustin Mierau <email@hidden>)

  • Prev by Date: NewbieQ: Why can't I have a customview as an initalResponder??
  • Next by Date: System Preferences doesn't wrap long name
  • Previous by thread: Centering a view in an NSScrollView
  • Next by thread: Magnification cursor
  • Index(es):
    • Date
    • Thread