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];

原文地址:https://www.cnblogs.com/1018475062qq/p/7010094.html