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

iOS 通知传值

2016-04-27 10:02 399 查看
    //创建通知 

    NSNotification * notification = [NSNotification notificationWithName:@"tongzhi" object:nil userInfo:nil];

   
//通过通知中心发送通知

    [[NSNotificationCenter defaultCenter]postNotification:notification];

//注册(接收通知)

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tongzhi) name:@"tongzhi" object:nil];

//用完以后移除通知

[[NSNotificationCenter defaultCenter]removeObserver:self name:@"tongzhi" object:nil];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: