Search code examples
xcode4weak-referencesiboutlet

The reason that IBOutlets are weak in Xcode


I read the related posts and don't quite get it. Should IBOutlets be strong or weak under ARC? My understanding is that since the top level view already has a strong pointer to the outlet automatically, so that we should not make another strong pointer to it from the controller. Therefore when the top level view is removed, the outlets could get removed too.

Is my understanding correct?


Solution

  • Yes, that's correct. You should bear in mind though, that outlets are not necessarily subviews of the main view - they can be top-level objects too, in which case you should declare their outlets as strong.