当我移动到另一个视图时,可以使用哪种方法来捕获事件?到目前为止,我尝试过但没有成功的东西:viewWillDisappear:,willMoveToParentViewController:,dealloc:
我正试图注销一个观察员的通知。
发布于 2018-05-29 10:17:15
现在不推荐使用viewDidUnload方法。
如果要注销通知的观察者,请在dealloc方法中尝试:
,例如
(void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
//or
[[NSNotificationCenter defaultCenter] removeObserver:self
name:@"notifiactionName" object:nil];
}https://stackoverflow.com/questions/50578945
复制相似问题