本文介绍了在Swift中删除NSNotification观察者的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该在Swift中删除 NSNotification
的观察者,因为 viewDidUnload
和 dealloc ()
不可用?
Where should I remove the observer for NSNotification
in Swift, since viewDidUnload
and dealloc()
are unavailable?
推荐答案
使用以下方法,其功能与相同dealloc
。
Use below method which functions same as dealloc
.
deinit {
// Release all resources
// perform the deinitialization
}
Swift Deinitializer
这篇关于在Swift中删除NSNotification观察者的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!