IBOutlet and viewDidUnload under ARC

前端 未结 5 792
野性不改
野性不改 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:47

    I have some empirical evidence to support that IBOutlets are indeed already set to nil automatically. Here's what I did:

    1. I set up explicit ivars for my IBOutlet properties (@synthesize myLabel = myLabel_) so that I may later inspect their values in the debugger.
    2. I enabled a breakpoint on the first line of viewDidUnload.
    3. I arranged for viewDidUnload to get called by simulating a memory warning.
    4. I inspected the values of the explicit ivars that I associated with my IBOutlet properties.

    The explicit ivars all had nil as their value then I hit the breakpoint.

提交回复
热议问题