- (instancetype)initWithTitle:otherButtonTitles, ... {
NSMutableArray *buttonTitleArray = [NSMutableArray array];
va_list args;
va_start(args, otherButtonTitles);
if (otherButtonTitles) {
[buttonTitleArray addObject:otherButtonTitles];
while (1) {
NSString *otherButtonTitle = va_arg(args, NSString *);
if (otherButtonTitle == nil) {
break;
} else {
[buttonTitleArray addObject:otherButtonTitle];
}
}
}
va_end(args);
//...后面略
}
如代码,定义时加上...
,这个写法可以参照UIActionSheet
的初始化呀。
用的时候使用va_list
循环获取。没去深究,就先记着这么用吧=。=