– (void)viewDidLoad
{
[super viewDidLoad];
//向通知中心注册一条通知“showsayhi”
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showsay:) name:@”showsayhi” object:nil];
}
-(IBAction)chickBtn:(id)sender{
//发送通知(传对象“www.gdcool.net”)
[[NSNotificationCenter defaultCenter] postNotificationName:@”showsayhi” object:@”www.gdcool.net”];
}
-(void)showsay:(NSNotification *)notification{
//接上传过来的对象“www.gdcool.net”
id text = notification.object;
NSLog(text);
}