码迷,mamicode.com
首页 > 移动开发 > 详细

ios下NSNotification的使用

时间:2014-12-22 17:45:40      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:

第一步:注册NSNotificaiton

[[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(func:)

                                                 name:@"notifiName"

                                               object:nil];

 

实现接收到通知后回调方法

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

}

 

第二步:发送通知

NSNotification *notification= [NSNotification notificationWithName:@"PlayVideo" object:showViewController userInfo:dict];

    [[NSNotificationCenter defaultCenter] postNotification:notification];

 

第三步:注销通知监听

  [[NSNotificationCenter defaultCenter]removeObserver:self

                                                  name:@"PlayVideo"

                                                object:nil];

ios下NSNotification的使用

标签:

原文地址:http://www.cnblogs.com/progfun/p/4178611.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!