• 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: converting rects between coordinate systems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: converting rects between coordinate systems


  • Subject: Re: converting rects between coordinate systems
  • From: j o a r <email@hidden>
  • Date: Thu, 5 Jun 2003 01:09:24 +0200

You are a bit confused about something here. You use the mehtods you mention to translate points between overlapping coordinate systems. Example: If you have a view contained in another view, the subview will have a x.y position offset from the 0.0 origin of the bounds of it's superview. This position is the origin of the subview's frame, and this x.y position is only of any value in the coordinate system of the superview.
You are asking about how to convert _sizes_, now sizes are the same between coordinate systems and does not need any conversion.
If you are looking for information on the frame of a view, use this method:

NSRect viewFrame = [aView frame];
float viewWidth = viewFrame.size.width.
etc.

If you want to control the frame of a view use these methods:

[aView setFrame: NSMakeFrame(0.0, 0.0, 12.0, 12.0)];
[aView setFrameOrigin: NSMakePoint(5.0, 5.0)];
[aView setFrameSize: NSMakeSize(24.0, 12.0)];

But back to your question, I'm not really sure what you're asking about. Could you rephrase it?
What is "the final size as represented in a superview"?

j o a r

On Wednesday, Jun 4, 2003, at 23:35 Europe/Stockholm, email@hidden wrote:

I need to be able to convert the size of a frame of a subview to its final size as represented in a superview. Since the bounds of the superview is generally much larger than that of the subview, the resulting image of the subview is scaled down. The width of this scaled down version is what is important. I have tried the NS View methods:

convertRect:fromView:
convertRect:toView:
convertSize:fromView:
convertSize:toView

but they down take scaling into account. I'm probably missing something simple, so please clue me in. Thanks.
_______________________________________________
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.

  • Follow-Ups:
    • Re: converting rects between coordinate systems
      • From: email@hidden
References: 
 >converting rects between coordinate systems (From: email@hidden)

  • Prev by Date: Re: Instantiating NSCells in Interface Builder
  • Next by Date: Re: Instantiating NSCells in Interface Builder
  • Previous by thread: converting rects between coordinate systems
  • Next by thread: Re: converting rects between coordinate systems
  • Index(es):
    • Date
    • Thread