-2

Suppose we have created two UIViewController type class, one is "AController" another is "BController".

Now on the tapping on a butoon on "AController" it pushed to the "BController", and on the tapping on a back button of "BController" it poped to the "AController".

I just want to get some value from "BController" to "AController" when it popped to the "AController", and I have used custom delgate.

So my question is that what will happened if we set property 'strong' of the delegate? Please explain.

1 Answers1

0

If BController has a strong reference to the delegate and the delegate has a strong reference to BController, then you will have a reference cycle and nether object will ever be removed from memory. If the user taps your button a lot, you will end up with a lot of BController and delegate objects in memory and none of them will be accessible or delectable.

Daniel T.
  • 32,821
  • 6
  • 50
  • 72