我有一个 NSNotificationCenter 选择器,
把它放在哪里?在委托中(如果是,那么在哪里?)在控制器中?
方法也放在哪里。
我需要解除分配 NSNotificationCenter 吗?
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceNotificationReceived:) name:UIApplicationDidBecomeActiveNotification object:nil];
- (void)deviceNotificationReceived:(NSNotification *)notification
{
[self.soundMgr endInterruption];
}
The deviceNotificationReceived:
方法必须是参数的实例方法addObserver:
. It is self
在这种情况下,所以你的方法应该放在同一个类中。
您不应该释放NotificationCenter,因为您没有创建或保留它。
你的问题有点难以理解,你问的是这个吗?
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)