Reputation: 1
I have two viewcontrollers(vcA and vcB), vcA it's parent for vcB(I added vcB over vcA with addChildViewController), in both controllers I have an object declared with strong argument. Before to present vcB I make somenthing vcB.myobject = self.myobject, can cause this a retain cycle? It's better to use weak argument for object from vcB?
Upvotes: 0
Views: 59
Reputation: 535316
That's not a retain cycle. It's merely two objects (vcA and vcB) with strong references to a third object (myObject
). That is normal and correct. Each will perform proper memory management on that third object, and it will not leak.
Upvotes: 2
Reputation: 385700
It causes a retain cycle if the object has a strong reference to one of the view controllers. If the object doesn't have a strong reference to either view controller, then it doesn't cause a retain cycle.
Upvotes: 2