NSNotificationCenter 发送 接受处理
来源:互联网 发布:雷云网络不可用 编辑:程序博客网 时间:2024/06/05 21:16
//发送通知 NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; //第二个参数是我们要传得值 ,这个参数必须是对象 NSNotification *not = [NSNotification notificationWithName:@"3" object:[NSString stringWithFormat:@"%d",num]]; [center postNotification:not];//接收消息NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@selector(secondDoWithNOtification:) name:@"3" object:nil];//发送的有参数 实现的功能也要有参数 而且是NSNotification类型的参数-(void)secondDoWithNOtification:(NSNotification*)notice{ //把收到的通知参数转为字符串 NSString *object = [notice object]; NSLog(@"%@",object); if ([object intValue] == 0) { UIButton *btn = (UIButton*)[self.view viewWithTag:1000]; [btn removeFromSuperview]; }else{ UIButton *btn = (UIButton*)[self.view viewWithTag:1001]; [btn removeFromSuperview]; }}
0 0
- NSNotificationCenter 发送 接受处理
- 通过NSNotificationCenter发送通知
- NSNotificationCenter发送通知
- NET-SNMP 发送接受并处理SNMP Trap/Notification
- NET-SNMP 发送接受并处理SNMP Trap/Notification
- NSNotificationCenter 处理自定义消息
- NSNotificationCenter 发送消息先后问题
- JMS发送和接受
- UDPC#发送接受聊天
- TCP接受发送示例
- 接受和发送广播
- 接受和发送广播
- Socket发送和接受
- XMPP接受发送消息
- zmq: 发送和接受
- 短信的接受发送
- 发送和接受数据
- ios NSNotificationCenter接受通知不能操作UI线程
- 多个文件开启固定线程等待下载--java实现
- Vmware克隆Centos后 重新设置eth0
- iOS NSString 与NSData转化
- 当中流击水,浪遏飞舟
- Matlab中数据拟合(简单粗暴不用写代码)
- NSNotificationCenter 发送 接受处理
- 我的Android进阶之旅------>如何将Activity变为半透明的对话框?
- android 自动化测试工具Robotium 之Solo类的详细说明
- PHP下载远程图片的3个方法
- Python笔记---Ubuntu 下使用 Python
- Jboss配置https
- 带哨兵与不带哨兵的插入排序
- LeetCode #16 3Sum Closest
- 常用设备接口类GUID