您的位置:首页 > 移动开发 > IOS开发

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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: