1、发通知
NSDictionary *myDictionary = [NSDictionary dictionaryWithObject:@"sendValue" forKey:@"sendKey"];
[[NSNotificationCenter defaultCenter] postNotificationName:@"myNotice" object:nil userInfo:myDictionary];
2、接受通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(noticeMethod:) name:@"myNotice" object:nil];
3、调用方法,接受信息。
- (void)noticeMethod:(NSNotification *)notification
{
NSString *getsendValue = [[notification userInfo] valueForKey:@"sendKey"];
}
网友评论