NSNotificationCenter

注册一个Notification

    [[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(receivedNotification:)

                                                 name:@"Address Found"

                                               object:nil];

 

激发一个Notification

[[NSNotificationCenter defaultCenter] postNotificationName:@"Address Found" object:self];

 

响应函数

- (void)receivedNotification:(NSNotification *) notification {

    if ([[notification name] isEqualToString:@"Address Found"]) {

        //do something;

    } 

}

posted on 2014-11-17 16:57  SCaptain  阅读(111)  评论(0编辑  收藏  举报

导航