[Openmcl-devel] [Q] Setting ObjC objects properties

Raffael Cavallaro raffaelcavallaro at mac.com
Thu Jun 26 09:32:32 PDT 2008


On Jun 26, 2008, at 12:02 PM, Didier Verna wrote:

> The Apple doc says that layoutManager is a property of a CALayer, as  
> in
> @property (retain) id layoutManager. I don't know what that means, but
> how do I set it in lisp ? I tried setf'inf a slot-value but that  
> doesn't
> work.


from the Apple doc on Objective-C 2.0:

Using the dot syntax, you can access a property using the same pattern  
as accessing structure elements.

MyClass *myInstance = [[MyClass alloc] init];
myInstance.value = @"New value";
NSLog(@"myInstance value: %@", myInstance.value);

The dot syntax purely “syntactic sugar”—it is transformed by the  
compiler into invocation of accessor
methods (so you are not actually accessing an instance variable  
directly). The code example above is
exactly equivalent to the following:

MyClass *myInstance = [[MyClass alloc] init];
[myInstance setValue:@"New value"];
NSLog(@"myInstance value: %@", [myInstance value]);

So:

rootLayer.layoutManager = [CAConstraintLayoutManager layoutManager];

is just syntactic sugar for:

[rootLayer setLayoutManager: [CAConstraintLayoutManager layoutManager]];

I'm not in front of CCL now, and I don't have quartzcore loaded, so  
see if the lisp equivalent of calling this automatically generated  
setter method works.

regards,

Ralph






Raffael Cavallaro, Ph.D.
raffaelcavallaro at mac.com




More information about the Openmcl-devel mailing list