NSNotificationCenter 观察者

来源:互联网 发布:网络教育入学考试科目 编辑:程序博客网 时间:2024/06/16 06:29

[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(test)name:@"test"object:nil];

[[NSNotificationCenterdefaultCenter] postNotificationName:@"test"object:nil];


[[NSNotificationCenterdefaultCenter] removeObserver:selfname:@"test"object:nil];

- (void)test

{

    NSLog(@"test ");

}


0 0
原创粉丝点击