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];
通过此三步即可
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];
通过此三步即可
相关文章推荐
- IOS block 记录
- iOS导航控制器使用interactivePopGestureRecognizer导致导航栏标题可能层次错乱的问题解决
- iOS开发系列--通讯录、蓝牙、内购、GameCenter、iCloud、Passbook系统服务开发汇总
- iOS开发系列--通知与消息机制
- iOS时间格式说明
- iOS时间戳字符串NSdate转换demo
- IOS开发系列--无限循环的图片浏览器
- iOS开发系列--触摸事件、手势识别、摇晃事件、耳机线控
- IOS 第三方管理库管理 CocoaPods
- iOS开发学习准备
- iOS类别(Category)和扩展(Extension,匿名类)
- 2015最新iOS二进制打包上传流程
- iOS开发系列--数据存取
- iOS手势之 响应上下左右滑动手势
- iOS 使用 RSA 加密, 只需要公钥
- iOS判断是否有权限访问相机,相册,定位
- IOS 本地通知
- iOS开发工具——统计Crash的工具Crashlytics
- 【吐槽】MAC 和 iOS 开发貌似相差挺大的
- iOS ShareSDK分享注意事项