Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

samhasi

macrumors newbie
Original poster
Mar 3, 2011
4
0
Hi all,
I'm bit confused here. What is the meaning of "receiver" in addSublayer method in CALayer. Is it the same as the superLayer????
any help would be appriciated:)

thanks.
 
"Receiver" always refers to the object you are sending the message to. So layer is the receiver in the following piece of code:

Code:
[layer addSublayer:otherLayer];

In this specific case, the receiver is the layer that you are adding the sublayer to.
 
The "receiver" is the same as it is for every other object. It is the object that you are communicating with. In this case using the method addSublayer:.

Experiment to see what superlayer is?

Code:
CALayer * layer1 = [CALayer layer];
CALayer * layer2 = [CALayer layer];
[layer2 addSublayer: layer1];  // layer2 is the receiver
NSLog(@"layer1 objectid: %@", layer1);
NSLog(@"layer2 objectid: %@", layer2);
NSLog(@"layer1.superlayer objectid: %@",layer1.superlayer);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.