viewDidUnload no longer called in ios6

前端 未结 3 1119
傲寒
傲寒 2021-02-01 19:38

I just installed the new version of Xcode/ios6. viewDidUnload is now depreciated.

In the apple doc,

viewDidUnload [...] Deprecated in iOS 6.0. Vi

相关标签:
3条回答
  • 2021-02-01 19:40

    and second one: What is the new recommended way to release an IBOutlet property ? In dealloc method ?

    What is the "old" recommended way? You must always release retained instance variables in dealloc; it has always been this way and continues to be this way.

    It was just that in viewDidUnload (which is only called for low memory) you could also set your properties to nil.

    0 讨论(0)
  • 2021-02-01 19:55

    For the first Question:

    Your ViewController will receive didReceiveMemoryWarning method callback and you can nil out the view & other components in this method

    For Reference Do Check WWDC 2012 video Session on EVOLUTION OF VIEW CONTROLLER, in case you haven't (I Believe they are available only for registered developers, but not sure).

    Answer to your second one.

    [object release]; in dealloc. No need to assign nil to object before releasing.

    0 讨论(0)
  • 2021-02-01 19:55

    I recommend you to use weak property for the IBOutlets like

    @property (weak) IBOutlet UILabel * labelText;
    

    That way you don't need to do anything in dealloc. In iOS 6, simply ViewDidUnload won't call, iOS5 or earlier it is just call when memory warning have occur.

    0 讨论(0)
提交回复
热议问题