NSNotification用法 1.点击发送一个通知。 - (void)menuItemClick:(id)sender; { [[NSNotificationCenter default
2011-09-21 10:04
555 查看
NSNotification用法
1.点击发送一个通知。
- (void)menuItemClick:(id)sender;
{
[[NSNotificationCenter
defaultCenter] postNotificationName:EVENT_SYSMENU_CLICK
object:sender];
}
2.添加通知的监听
[[NSNotificationCenter
defaultCenter]
addObserver:self
selector:@selector(handler_menu_click:)
name:EVENT_SYSMENU_CLICK
object:nil];
3.实现得到通知时调用方法
- (void)handler_menu_click:(NSNotification *)noti;
{
NSLog(@"handler_menu_click %@",noti.object);
}
1.点击发送一个通知。
- (void)menuItemClick:(id)sender;
{
[[NSNotificationCenter
defaultCenter] postNotificationName:EVENT_SYSMENU_CLICK
object:sender];
}
2.添加通知的监听
[[NSNotificationCenter
defaultCenter]
addObserver:self
selector:@selector(handler_menu_click:)
name:EVENT_SYSMENU_CLICK
object:nil];
3.实现得到通知时调用方法
- (void)handler_menu_click:(NSNotification *)noti;
{
NSLog(@"handler_menu_click %@",noti.object);
}
相关文章推荐
- NSNotificationCenter defaultCenter 通知的简单实用
- cocos js 怎样设置一个按钮(MenuItemSprite)为不可点击状态?
- [NSNotificationCenter defaultCenter] 通知接收不全面原因
- 通知传值[NSNotificationCenter defaultCenter]
- IOS通知中心(观察者模式)[NSNotificationCenter defaultCenter]
- IOS NSNotificationCenter(通知 的使用)监听文本框的文字改变
- Android 点击通知栏图标 返回已经运行的程序,而不开启一个新的Activity
- [NSNotificationCenter defaultCenter]全局监听传数值
- ListView集合中设置标记 setTag();方法带一个参数和两个参数的区别,以及设置标记时ViewHolder中的每一个属性控件都需要设置一次,否则在Item中每一个控件的点击事件中取出设置的标
- swift 快速奔跑的兔几 本节的内容是:用NSNotification发送通知
- Extjs中给一个组件命名时,id,name,hiddenName这三者的用法和区别是什么
- 通知中心NSNotificationCenter的使用
- 触摸和点击的冲突以及手势onTouchEvent,performClick,performItemClick ,GestureDetector
- CCMenu超过CCScrollView边框还能点击处理,以及拖动CCMenuItem不响应点击事件
- ListView Item 里多种点击事件的用法
- iOS开发中点击UITabBarItem弹出一个控制器(如常见未登录用户点击购物车弹出登录页面的效果)
- 用android仿写一个可视化语音信箱界面且保证点击item动画展开可以完全显示
- JQuery 多个ID对象绑定一个click事件