通知

2018-05-23  本文已影响0人  安红唯CC

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[@"字典参数"]) {  }  }
上一篇 下一篇

猜你喜欢

热点阅读