Need help in Retain Cycle


In the code [i setContainer:self];
Why are we sending a message to i ?
why we are using self as an argument ? And what is the value of self ?


i is the object that was passed as an argument. So in this particular application, i points to the calculator object. Self is the object that was sent the message, and in this particular application, it points to the backpack object.

One way you can verify this is to print both of these objects to the console in that method:

NSLog(@"%@ %@", i, self);