IOS 通知模式
发布日期:2021-11-21 04:41:02
浏览次数:43
分类:技术文章
本文共 850 字,大约阅读时间需要 2 分钟。
-(void)handleTerminate:(NSNotification*)notification{ NSDictionary *theData = [notification userInfo]; if (theData != nil) { NSDate *date = [theData objectForKey:@"TerminateDate"]; NSLog(@"MainViewController App Terminate Date: %@", date); }}
处理监听到通知处理
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(handleTerminate:) name:@"AppWillTerminateNotification---" object:nil];进行监听
NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys: @"helloword",@"TerminateDate", nil]; [[NSNotificationCenter defaultCenter]postNotificationName:@"AppWillTerminateNotification---" object:nil userInfo:dic];
发送通知
2014-03-26 16:37:45.643 州22[5506:60b] MainViewController App Terminate Date: helloword处理结果---
转载地址:https://blog.csdn.net/xiaoji94shen/article/details/22191061 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
初次前来,多多关照!
[***.217.46.12]2024年04月16日 21时35分04秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
3NF分解(无损+4NF)
2019-04-26
计算机各层网络协议
2019-04-26
划分子网的意义
2019-04-26
AndroidQ 以上禁用 wifi 随机mac功能
2019-04-26
AngularJS学习之二:配置本地开发环境
2019-04-26
AngularJS学习之三:学习Angular
2019-04-26
AngularJS学习:Angular的模块
2019-04-26
Angular学习:控制器(未翻译完)
2019-04-26
Angular学习:$q
2019-04-26
XML节点和元素的关系
2019-04-26
JavaScript---网络编程(9-2)--DHTML技术演示(2-2)-表格加强
2019-04-26
机器学习笔记(七)机器学习(L1,L2正则化----处理过拟合问题)
2019-04-26
机器学习笔记(八) 机器学习(逻辑回归-----计算概率)
2019-04-26
机器学习笔记(九)机器学习(运用逻辑回归解决分类问题)
2019-04-26
机器学习笔记(十)机器学习(神经网络基本知识)
2019-04-26
机器学习笔记(十一) 机器学习( 训练神经网络)
2019-04-26
机器学习笔记(十二)机器学习(多类别神经网络,softmax)
2019-04-26
机器学习笔记(十三)机器学习(卷积神经网络CNN基本认知)
2019-04-26
Machine Learning吴恩达视频课(绪论,单变量线性回归,梯度下降)
2019-04-26
Machine Learning吴恩达视频课(线性代数)
2019-04-26