IBOutlet and viewDidUnload under ARC

前端 未结 5 811
野性不改
野性不改 2021-01-30 09:01

There is a similar question to this on SO here, however I just want to clarify something that wasn\'t fully explained there.

I understand that all delegates and outlets

5条回答
  •  旧巷少年郎
    2021-01-30 09:48

    From my understanding of how the outlets are managed in ARC if you are using a weak reference, you do not need to add anything to viewDidUnload as it will already be nil. Doing so is thus redundant.

    However if you do have strong outlets, which apple says you should do if you are pointing to a top level item in the nib, then you should definitely continue to add the appropriate line in viewDidUnload to nil out these ones.

提交回复
热议问题