注册通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showRegisteSucceed:) name:@"showRegisteSucceed" object:nil];
- (void)showRegisteSucceed:(NSNotification *)noti{
NSString *title = noti.userInfo[@"title"];
NSString *message = noti.userInfo[@"message"];
[self showRegisterSucceedAlertWithTitle:title message:message];
}
发送通知
NSString *title = @"尊贵的会员";
NSString *message = [NSString stringWithFormat:@"您的用户名是%@, 默认密码是%@, 如需更改密码请移步至设置页面", _strOfUserName, _strOfPwd];
//添加 字典,将label的值通过key值设置传递
NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:title, @"title", message, @"message", nil];
//创建通知
NSNotification *notification =[NSNotification notificationWithName:@"showRegisteSucceed" object:nil userInfo:dict];
//通过通知中心发送通知
[[NSNotificationCenter defaultCenter] postNotification:notification];