IOS 发送通知的时候传入参数

    NSDictionary *searchDic = [NSDictionary dictionaryWithObject:searchText forKey:@"searchText"];

    [[NSNotificationCenter defaultCenter] postNotificationName:@"searchText" object:self userInfo:searchDic];

            // 采用这种方式

            NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:3];

            userInfo[@"msg"] = resultDic[@"memo"];

            userInfo[@"resultStatus"] = resultDic[@"resultStatus"];

            [[NSNotificationCenter defaultCenter] postNotificationName:MALL_PAY_ACTION_CALLBACK_NOTIFICATION object:nil userInfo:userInfo];

posted on 2017-06-14 17:43  1018475062  阅读(322)  评论(0编辑  收藏  举报