• 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: store the NSPoint in an dictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: store the NSPoint in an dictionary


  • Subject: Re: store the NSPoint in an dictionary
  • From: Greg Titus <email@hidden>
  • Date: Thu, 28 Jun 2001 23:47:32 -0700

On Thursday, June 28, 2001, at 11:12 PM, Annie Felix wrote:

Hi
My program draws a circle on mouse click.
On Mouse drag it draws a line.
On mouse release it draws another circle.
Now I have got two points, which I store in NSPoint.
Now I want to store these points in an dictionary for reference.
How should I do it.

Hi Annie,

Look at NSGeometry.h's extensions to NSValue which includes:

+ (NSValue *)valueWithPoint:(NSPoint)point;
+ (NSValue *)valueWithSize:(NSSize)size;
+ (NSValue *)valueWithRect:(NSRect)rect;
- (NSPoint)pointValue;
- (NSSize)sizeValue;
- (NSRect)rectValue;

So you can create an NSValue object with the +valueWithPoint: method, store the value in your dictionary, then retrieve the point from it by sending the value object a -pointValue message.

Hope this helps,
--Greg


References: 
 >store the NSPoint in an dictionary (From: Annie Felix <email@hidden>)

  • Prev by Date: Re: NSFileManager
  • Next by Date: Re: store the NSPoint in an dictionary
  • Previous by thread: store the NSPoint in an dictionary
  • Next by thread: Re: store the NSPoint in an dictionary
  • Index(es):
    • Date
    • Thread