• 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: NSView unit scale question ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView unit scale question ?


  • Subject: Re: NSView unit scale question ?
  • From: Robert Miller <email@hidden>
  • Date: Mon, 21 Feb 2005 08:55:22 -0500

John,
    
    Thanks for the insight. Regarding your statement:

"The resizing behavior pertains to the frame, and not the bounds. Once you've scaled the bounds, if the frame changes, the view may appear to move in unexpected ways depending on the view's own coordinate space (it may be inverted, for example).

Is it possible to programmatically prevent this resizing behavior when scaling and then resizing the frame to display the entire bounds of the view ?

Thanks again,
Bob

On Feb 19, 2005, at 9:28 PM, John C. Randolph wrote:


On Feb 18, 2005, at 7:03 AM, Robert Miller wrote:


Hello,


    Has anyone had in depth experience with the 'scaleUnitSquareToSize' call vs. the resulting frame size of the receiver ? I'm working on an application that has movable / resizable custom subviews that are also scalable. I've done some research and have discovered some very useful examples on scaling using the scaleUnitSquareToSize' call and understand it's use and how the bounds rectangle of a view is affected by this call.  The call does not affect the frame rectangle as would be expected however, I want to be able to display the entire scaled bounds in the NSView after scaling.


The frame of a view is the view's location and size in its superview's coordinate space.  -scaleUnitSquareToSize: affects the bounds, not the frame of a view.


I've added some code which effectively readjusts the frame rectangle to do this. The real issue is that once a view is scaled it seems that any subviews within that view seem to have lost their auto resize mask. (even though diagnosis has shown that they haven't) The behavior of subviews when a previously scaled view is subsequently resized appears as if they have. Example. A custom view is created and displayed, the custom view contains sub views whose 'spring' settings include NSViewMinYMargin and NSViewMaxXMargin which cause the subviews to 'stick' to the top left corner of the view when the view is resized such that its width and height are increased. After the view is scaled the subviews no longer behave as if the previously mentioned resize settings are in effect. (even though as previously stated the values for resizing have not changed). In other words when the view is resized after a scale is applied the subviews now move and no longer stick to the top left corner. Is this some strange anomaly with scaling and resizing mask behaviors internal to NSView. Does my example make sense ?


The resizing behavior pertains to the frame, and not the bounds. Once you've scaled the bounds, if the frame changes, the view may appear to move in unexpected ways depending on the view's own coordinate space (it may be inverted, for example).


-jcr



John C. Randolph <email@hidden> (408) 974-8819

Sr. Cocoa Software Engineer,

Apple Worldwide Developer Relations

http://developer.apple.com/cocoa/index.html





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSView unit scale question ? (From: Robert Miller <email@hidden>)
 >Re: NSView unit scale question ? (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Overlapping views no more
  • Next by Date: Automatic key view handling
  • Previous by thread: Re: NSView unit scale question ?
  • Next by thread: How to create a subview NIB
  • Index(es):
    • Date
    • Thread