3
我认为控制器之一,它增加了本身的UITextViewTextDidEndEditingNotification通知观察者,像下面这样做是dealloc上必需的removeObserver?
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(done:) name:UITextViewTextDidEndEditingNotification object:nil];
现在我想知道 - 我需要做以下时,视图控制器dealloc'd
[[NSNotificationCenter defaultCenter] removeObserver:self];
Docs:“如果您的应用程序面向iOS 9.0或更高版本或MacOS 10.11及更高版本,则无需在其解除分配方法中取消注册观察者,如果您的应用程序面向早期版本,请务必调用removeObserver:name:object :在观察者或addObserver中指定的任何对象之前:选择器:name:object:被释放。“ – Liviu 2017-07-31 16:15:56