您的位置:首页 > 移动开发 > IOS开发

iOS中通知传值的使用

2015-07-13 15:26 344 查看
传值有很多种,个人觉得通知模式使用起来相对简单,步奏如下:

1:注册一个通知中心:如://添加字典

NSDictionary*dict=@{。。。。。};

//创建通知

NSNotification*notification=[NSNotification
notificationWithName:@"tongzhi"object:niluserInfo:dict];
2:发通知





//通过通知中心发送通知
[[NSNotificationCenterdefaultCenter]postNotification:notification];
3:在想接收的页面注册观察者进行接收通知

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


通过此三步即可

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: