iOS通知传值的使用
来源:互联网 发布:无法优化游戏的问题 编辑:程序博客网 时间:2024/06/05 08:22
iOS通知传值的使用输入所要发送的信息 ,同时将label的值通过button方法调用传递,- (IBAction)buttonClick:(id)sender { //添加 字典,将label的值通过key值设置传递 NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:self.textFieldOne.text,@"textOne",self.textFieldTwo.text,@"textTwo", nil]; //创建通知 NSNotification *notification =[NSNotification notificationWithName:@"tongzhi" object:nil userInfo:dict]; //通过通知中心发送通知 [[NSNotificationCenter defaultCenter] postNotification:notification]; [self.navigationController popViewControllerAnimated:YES]; }在发送通知后,在所要接收的控制器中注册通知监听者,将通知发送的信息接收- (void)viewDidLoad { [super viewDidLoad]; //注册通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi:) name:@"tongzhi" object:nil]; }- (void)tongzhi:(NSNotification *)text{ NSLog(@"%@",text.userInfo[@"textOne"]); NSLog(@"-----接收到通知------"); }
0 0
- iOS通知传值的使用
- iOS通知Notification传值的使用
- iOS中通知传值的使用
- iOS之通知传值的使用
- iOS通知NSNotification传值的使用
- iOS---通知传值的使用
- iOS 通知传值的使用
- iOS通知传值的使用
- iOS 通知的基本使用传值
- iOS通知传值的使用
- IOS通知的使用
- ios 通知的使用
- iOS通知的使用
- IOS 通知的使用
- iOS NSNotification 通知的使用
- iOS通知的简单使用
- ios NSNotification通知的使用
- iOS NSNotification的使用 通知
- OC中关于copy和mutableCopy的使用 及深拷贝、浅拷贝的概念
- PAT乙级—1006. 换个格式输出整数 (15)-native
- 美斯坦福在线考试系统 长工职SCCE G2 SQLadvance测试题
- 朴素、Select、Poll和Epoll网络编程模型实现和分析——Epoll模型
- SQL Server 2008 R2:快速清除日志文件的方法
- iOS通知传值的使用
- 进程监控程序-java
- Maven学习 (一) 搭建Maven环境
- opencv读取并显示两个摄像头
- 2-3-4 Tree
- qwerq
- Android事件分发机制
- PHP干货
- do...while(0)的妙用