您好,登錄后才能下訂單哦!
-(id) initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles,...NS_REQUIRES_NIL_TERMINATION;
關于多參數的接法;
va_list argumentList;
NSMutableArray * arrlist = [NSMutableArrayarray];
if(otherButtonTitles){
[arrlist addObject:otherButtonTitles];
va_start(argumentList, otherButtonTitles);
while (NSString * eachobject = va_arg(argumentList, id))
[arrlist addObject:eachobject];
va_end(argumentList);
}
只不過這是用c++
va_list argumentList;
va_start(argumentList, otherButtonTitles);
NSMutableArray * arr = [NSMutableArray array];
for (NSString * eachobject = otherButtonTitles; eachobject != nil; eachobject = va_arg(argumentList,id )) {
[arr addObject: eachobject];
}
va_end(argumentList);
這樣也蠻好
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。