要自定义一个alertView 去看原生的api 不想传字符串数组,想像他一样传多个NSString,然后接口写好如何取不会了,查资料 发现了这个 留存
https://developer.apple.com/library/content/qa/qa1405/_index.html
我这块的代码
- (instancetype)initWithTitle:(NSString *)titles andImage:(UIImage *)promptImage cancleButton:(NSString *)cancleButton otherButtons:(NSString *)otherButtons, ...
{
if (self = [super init]) {
self.alertTitle = titles;
self.promptImage = promptImage;
self.cancleButtonTitle = cancleButton;
NSMutableArray *otherBtnsArr = [[NSMutableArray alloc] init];
id eachObject;
va_list argumentList;
if (otherButtons) // The first argument isn't part of the varargs list,
{ // so we'll handle it separately.
[otherBtnsArr addObject: otherButtons];
va_start(argumentList, otherButtons); // Start scanning for arguments after firstObject.
while ((eachObject = va_arg(argumentList, id))) // As many times as we can get an argument of type "id"
[otherBtnsArr addObject: eachObject]; // that isn't nil, add it to self's contents.
va_end(argumentList);
}
NSLog(@"%@",otherBtnsArr);
}
return self;
}