第一步:注册NSNotificaiton
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(func:)
name:@"notifiName"
object:nil];
实现接收到通知后回调方法
-(void) PlayVideo:(NSNotification *)notification {
}
第二步:发送通知
NSNotification *notification= [NSNotification notificationWithName:@"PlayVideo" object:showViewController userInfo:dict];
[[NSNotificationCenter defaultCenter] postNotification:notification];
第三步:注销通知监听
[[NSNotificationCenter defaultCenter]removeObserver:self
name:@"PlayVideo"
object:nil];
时间: 2024-10-12 15:57:48