NSNotificationCenter 用法

来源:互联网 发布:java研发工程师深圳 编辑:程序博客网 时间:2024/06/05 02:55

1. 定义一个方法

update

 

2. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update) name:@"update" object:nil]

 

3. 在要发出通知消息的地方

[[NSNotificationCenter defaultCenter] postNotificationName:@"update" object:nil];

 

看贴请回帖!

原创粉丝点击