• 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
properties attributes misunderstanding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

properties attributes misunderstanding


  • Subject: properties attributes misunderstanding
  • From: Colin Howarth <email@hidden>
  • Date: Wed, 30 Sep 2009 15:02:45 +0200

Hi,

I have a class


@interface Ray : NSObject {

	...
	NSBezierPath		*path;
	...
}
@property (copy)	NSBezierPath	*path;
@end


an instance of which is accessed in another class:


- (void)drawRect:(NSRect)rect
{
NSBezierPath *temporaryPathPointerWhichIsSupposedToBeDifferent;
...
temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path];
[temporaryPathPointerWhichIsSupposedToBeDifferent transformUsingAffineTransform: aVeryLongDescriptiveTransformName];
[temporaryPathPointerWhichIsSupposedToBeDifferent stroke];
...
}



I thought the (copy) attribute would mean that temporaryPathPointerWhichIsSupposedToBeDifferent would be, well, a copy of the original path instance (which conforms to the NSCopying protocol). Of course, the compiler doesn't care what *I* think should happen, and applies the transform to path (which is identical to temporaryPathPointerWhichIsSupposedToBeDifferent).


It works if I do:

	temporaryPathPointerWhichIsSupposedToBeDifferent = [ray.path copy];

instead.

Why isn't it doing what I think it should do though?


Thanks,


colin _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: properties attributes misunderstanding
      • From: Roland King <email@hidden>
    • Re: properties attributes misunderstanding
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Re: How to tell if NSArrayController has a selected CoreData instance?
  • Next by Date: Re: properties attributes misunderstanding
  • Previous by thread: Re: Temporarily disabling all input events while non-blocking animations are playing
  • Next by thread: Re: properties attributes misunderstanding
  • Index(es):
    • Date
    • Thread