1:
[[NSNotificationCenter defaultCenter] postNotificationName:@"通知名字"
object:nil
userInfo:@{字典}];
2:
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
3:
- (instancetype)init
{ self = [super init];
if (self) {
//接收通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mainPageOperation:) name:@"mainPageOperation" object:nil];
} return self;}
4:
-(void)mainPageOperation:(NSNotification *)notification{ if (notification.userInfo[@"字典参数"]) { } }
网友评论