dealloc in Swift

前端 未结 6 1040
猫巷女王i
猫巷女王i 2020-12-23 13:19

I would like to perform some cleanup at the end of a view controller\'s life, namely to remove an NSNotificationCenter notification. Implementing dealloc<

6条回答
  •  猫巷女王i
    2020-12-23 13:46

    If you really want to remove something when view goes out of scope and start when in scope, I would suggest let's do it in the controller's didAppear and didDisappear method. Even NSNotificationCenter also can remove and added back when the view appears/disappear.

提交回复
热议问题