//demo:
#import "ViewController.h"
@interface ViewController ()
@property(nonatomic,strong) NSMutableArray *arr;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[ self addButton:@"aaa",@"dddd",@"3333",nil ];
NSLog(@"arr %@",self.arr);
}
-(void)addButton:(NSString *)sender,...{
self.arr = [NSMutableArray array];
va_list aaa;
va_start(aaa, sender);
if (sender) {
[self.arr addObject:sender];
while (1) {
NSString *temp = va_arg(aaa, NSString*);
if (temp ==nil) {
break;
}else{
[self.arr addObject:temp];
}
}
}
va_end(aaa);
}