首页 > 移动平台 > 详细

IOS中NSNotification使用笔记

时间:2014-06-07 13:37:17      阅读:425      评论:0      收藏:0      [点我收藏+]

1 基本用法

添加观察(可能很多页面)


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeIntlCode:) name:NOTIFICATION_SUCCESS_SELECT_INTLCODE object:nil];


发出通知(可能只有一个页面)

[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_SUCCESS_SELECT_INTLCODE object:nil userInfo:[NSDictionary dictionaryWithObject:model forKey:@"selectedIntlCodeModel"]];


在 dealloc中移除监听

[[NSNotificationCenter defaultCenter] removeObserver:self name:NOTIFICATION_SUCCESS_SELECT_INTLCODE object:nil];




IOS中NSNotification使用笔记,布布扣,bubuko.com

IOS中NSNotification使用笔记

原文:http://blog.csdn.net/xdrt81y/article/details/28436665

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!