IOS 广播——跳转后返回执行方法
2015-10-27 15:16
337 查看
从A——>B
在B界面点击事件中执行,返回A
[self
dismissViewControllerAnimated:YES
completion:^{
[[NSNotificationCenter
defaultCenter] postNotificationName:@"loginsuccess"
object:self];
}];
在A界面注册广播在ViewWillAppear中执行
NSNotificationCenter *nc = [NSNotificationCenter
defaultCenter];
[nc addObserver:self
selector:@selector(handleColorChange:)
name:@"loginsuccess"
object:nil];
并且在A界面中添加接受广播后执行方法
-(void)handleColorChange:(NSNotification*)sender{
NSLog(@"%@",sender);
}
在B界面点击事件中执行,返回A
[self
dismissViewControllerAnimated:YES
completion:^{
[[NSNotificationCenter
defaultCenter] postNotificationName:@"loginsuccess"
object:self];
}];
在A界面注册广播在ViewWillAppear中执行
NSNotificationCenter *nc = [NSNotificationCenter
defaultCenter];
[nc addObserver:self
selector:@selector(handleColorChange:)
name:@"loginsuccess"
object:nil];
并且在A界面中添加接受广播后执行方法
-(void)handleColorChange:(NSNotification*)sender{
NSLog(@"%@",sender);
}
相关文章推荐
- ios推送消息的基本原理
- iOS_开发_工具_Terminal命令
- 如何进行iOS 性能测试
- 如何进行iOS性能测试-------Instruments 使用教程
- iOS 中extern、static修饰变量的使用及define和const区别
- iOS设置处理异常的方法
- IOS中定时器NSTimer的开启与关闭
- 利用AVFoundation实现录音和播放
- iOS设置NSString的枚举
- IOS数据刷新(上拉刷新和下拉刷新)
- iOS使用自定义字体
- iOS 精益编程
- iOS 添加好友请求要怎么注册监听
- iOS开发火爆的背后
- IOS通知的注册和调用
- iOS中CoreData
- IOS开发之自定义系统弹出键盘上方的view
- iOS -- KVC && KVO
- iOS中对数组的删除操作注意点
- 整理iOS9适配中出现的坑(图文)(一)