• 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: Resizing view content
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resizing view content


  • Subject: Re: Resizing view content
  • From: publiclook <email@hidden>
  • Date: Wed, 22 Oct 2003 14:43:06 -0400

The position of scroll bars is based on the frame of the NSScrollView's document view in relation to the bounds of the NSScrollView's content view which is an NSClipView.

If you leave the document view's frame view unchanged and change only its bounds, you are scaling the content of the document view, but as far as the scroll view is concerned, nothing has changed. If you change the frame of the document view, the scroll view will automatically reposition scrollers etc.

The entire view system is explained in detail with diagrams in the book "Cocoa Programming" :)
Chapter 19 of "Building Cocoa Applications: A Step-by-Step Guide" includes "Adding a Zoom Button to GraphPaper"

Useful Apple documentation links including a section called "About Scroll Views":
http://developer.apple.com/documentation/Cocoa/Conceptual/DrawViews/ index.html
http://developer.apple.com/documentation/Cocoa/Conceptual/DrawViews/ Tasks/TransformingCoords.html

I your case, I suggest that you set the frame of the content view to whatever size you want it to be within the scroll view but leave the content view bounds unchanged.


On Wednesday, October 22, 2003, at 12:10 PM, John Timmer wrote:

From: John Timmer <email@hidden>
Date: Wed Oct 22, 2003 12:10:50 PM US/Eastern
To: <email@hidden>
Subject: Resizing view content

I've got an NSScroll view that I'd like to scale the contents of to fit a
specific size. I've found that getting the document view and calling:

[thePrintView scaleUnitSquareToSize: NSMakeSize( 0.63, 0.63)];

Scales it down nicely, but now there's a lot of white space at the bottom.
I've tried resetting the bottom of the bounds origin (to 0- .37 * the
previous height), but I still wind up with white space (now, both on the top
and the bottom). I'm not going to try resizing the containing view until I
actually get my view down to the bottom of it first, but I assume I won't
get that right immediately, too.

Is there a better way to scale the contents? Any examples?

Incidentally, I can't find a cogent description of the difference between
the bounds and the frame of a view, which might help me sort this out on my
own.

Cheers,

JT
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Resizing view content (From: John Timmer <email@hidden>)

  • Prev by Date: Re: Resizing view content
  • Next by Date: Re: Way to get IB to always be aware of my constantly used classes?
  • Previous by thread: Re: Resizing view content
  • Next by thread: Aqua-style custom views
  • Index(es):
    • Date
    • Thread