NSNotification带参数
来源:互联网 发布:知乎live过期收听购买 编辑:程序博客网 时间:2024/06/05 18:37
发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:OTAUpdatingNotification
object:characteristic];
接受通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(OTAUpdating:) name:OTAUpdatingNotification object:nil];
接受通知の处理
-(void)OTAUpdating:(NSNotification *)notification
{
CBCharacteristic *characteristic = [notification object];
NSData *Data = characteristic.value;
// Data转String
}
1、带参数
//注册通知//方法实现
[[NSNotificationCenter defaultCenter] addObserver:self selector:
@selector(updatCardInfo:) name:updateCardInfoNotification object:nil];
//方法实现
-(void) updatCardInfo :(NSNotification*) notification
{
接收参数 = [notification object]; //通过这个获取到传递的对象
}
//发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:
updateCardInfoNotification object:参数];
2、不带参数
//注册通知
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(deviceDamage) name:VDBlueToothDamageNotification
object:nil];
//方法实现
-(void)deviceDamage
{
}
//发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:
VDBlueToothDamageNotification object:nil];
- NSNotification带参数
- NSNotification 传递参数
- 使用NSNotification传递参数
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- NSNotification
- 游标:带参数,不带参数举例
- Java基础整理
- Sqoop - Import All Tables
- dtd
- 图形的认识(curve,surface,hypersurface)
- 终于弄懂了晦涩难懂的条件锁-condition lock
- NSNotification带参数
- CAFFE学习笔记(一)Caffe_Example之训练mnist
- [生存志] 第25节 历代大事件概览 元朝
- APP调用服务器API设计
- android 点击图像显示大图
- NSTextAttachment
- Session缓存和Cache缓存
- spark-shell示例
- 插入排序(InsertSort)