根据key修改字典value

    // NSDictionary不能直接修改,先转换成NSMutableDictionary

    NSDictionary *dic=@{@"like":@"0",@"red":@"0"};

    NSMutableDictionary *mutableDic = [NSMutableDictionary dictionaryWithDictionary:dic];

    [mutableDicsetObject:@"1"forKey:@"HasLike"];

    [mutableDicsetObject:@"1"forKey:@"LikeNums"];

你可能感兴趣的:(根据key修改字典value)