一:发送通知
//需要传的数据 存放在dict中
NSDictionary *dict = @{@"id":self.kreposted.shortcode};
//发送通知 openMedia
[[NSNotificationCenter defaultCenter] postNotificationName:@"openMedia" object:nil userInfo:dict];
二:接受通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openMedia:) name:@"openMedia" object:nil];
三:处理通知传值
-(void)openMedia:(NSNotification*)notification{
//取值
NSString * shortcode = notification.userInfo[@"id"];
//处理传过来的数据
}
网友评论