//
//  NSMutableDictionary+MuiltKeyValue.m
//  zhuxun
//
//  Created by winsoft on 17/6/16.
//
//

#import "NSMutableDictionary+MuiltKeyValue.h"

@implementation NSMutableDictionary (MuiltKeyValue)
+ (NSMutableDictionary *)dictWithKeys:(NSString *)keys,...NS_REQUIRES_NIL_TERMINATION
{

  
    
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    
    va_list params;//定义一个指向个数可变的参数列表指针
    va_start(params, keys);//va_start 得到第一个可变参数地址
    NSString *arg;
    if (keys) {
        //将第一个参数添加到array
        id prev = keys;
        [dict setObject:prev forKey:prev];
        
        //va_arg 指向下一个参数地址
        //
        while ((arg = va_arg(params, NSString *))) {
            if (arg) {
                NSLog(@"%@",arg);
                [dict setObject:arg forKey:arg];
             
            }
        }
        //置空
        va_end(params);
    }
    return dict;
}
@end
