//创建通知
NSNotification * notification = [NSNotification notificationWithName:@"tongzhi" object:nil userInfo:nil];
//通过通知中心发送通知
[[NSNotificationCenter defaultCenter]postNotification:notification];
//注册(接收通知)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi) name:@"tongzhi" object:nil];
//用完以后移除通知
[[NSNotificationCenter defaultCenter]removeObserver:self name:@"tongzhi" object:nil];
本文介绍了如何在iOS应用中使用通知中心发送和接收通知。包括创建通知、通过通知中心发送通知、注册接收通知以及移除通知等关键步骤。
982

被折叠的 条评论
为什么被折叠?



