通知的添加和移除通过block实现
来源:互联网 发布:易建联nba首秀数据 编辑:程序博客网 时间:2024/06/05 18:41
//监听通知
__blockid notification = [[NSNotificationCenterdefaultCenter]addObserverForName:NOTI_WEALTH_SUCCESS
object:nil queue:[NSOperationQueuemainQueue] usingBlock:^(NSNotification *note)
{
CKModelWealth *wealth = note.object;
//执行方法
{
。。。。。。。
}
//方法执行完后,移除监听事件
[[NSNotificationCenterdefaultCenter]removeObserver:notification];
}];
#if NS_BLOCKS_AVAILABLE
- (id)addObserverForName:(NSString *)name object:(id)obj queue:(NSOperationQueue *)queue usingBlock:(void (^)(NSNotification *note))block NS_AVAILABLE(10_6,4_0);
// The return value is retained by the system, and should be held onto by the caller in
// order to remove the observer with removeObserver: later, to stop observation.
#endif
[[NSNotificationCenterdefaultCenter]postNotificationName:NOTI_WEALTH_SUCCESSobject:wealth];
- 通知的添加和移除通过block实现
- iOS通知的添加和移除
- iOS通知观察者的添加和移除
- 实现View的添加和移除动画
- jquery复选的添加和移除
- 状态的添加和移除。class
- ios-day08-02(ios的通知机制:通知的发布、监听、移除,一些常见的系统通知、键盘状态的通知、通知和代理的异同)
- 通知、delegate和block的区别
- block和代理,通知的区别
- Magento 移除block
- Android RecyclerView 详解(三) RecyclerView的动画实现(移除、添加、改变、移动)和自定义动画的实现
- 移除通知
- Volley的Request的添加、移除和取消
- 代理 通知 和block
- listbox之间item的添加和移除
- oracle中数据表字段的添加和移除
- js外部样式和style属性的添加移除
- 本地通知(UILocalNotification)的学习和使用(通过本地通知实现提醒功能)
- 华为2013实习上机题
- CString和string的互相转换
- C++字符串格式化
- make 出现的错误
- 博客开篇 - 序
- 通知的添加和移除通过block实现
- 腾达w541u交叉编译(ARM)
- linux lsof命令详解
- windows2003 IIS6显示php错误信息的方法
- 跟Google学习Android开发-起始篇-共享内容(2)
- git 颜色问题
- Unsupported major.minor version 51.0
- 连号区间数 - 蓝桥杯
- Java安全编码标准