ios 产生和监听事件notification

来源:互联网 发布:编程金字塔图案 编辑:程序博客网 时间:2024/06/05 07:03


产生事件

[[NSNotificationCenterdefaultCenter] postNotificationName:@"chooseSortType"object:indexPath];


监听事件并注册响应函数

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


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

    NSLog(@"clicked");

}
0 0