实例:
- (void)addParams:(NSString *)string, ...NS_REQUIRES_NIL_TERMINATION {
NSLog(@"print first string: %@",string);
if (string) {
va_list args;
va_start(args, string);
NSString *eachString = string;
while (eachString) {
eachString = va_arg(args, NSString *);
NSLog(@"print next string %@",eachString);
}
va_end(args);
}
}
调用:
[self addParams:@"0",@"1",@"2",@"3",nil];
网友评论