【发布时间】:2012-01-06 04:31:02
【问题描述】:
例如,这是我的 C ( & Objective-C ) 方法,如下所示。
void ALERT(NSString *title, NSString *message,NSString *canceBtnTitle,id delegate,NSString *otherButtonTitles, ... )
{
// HERE I CAN ACCESS ALL THOSE ARGUMENTS
// BUT I AM NOT SURE How to access additional arguments, supplied using ... ?
UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:title
message:message
delegate:delegate
cancelButtonTitle:canceBtnTitle
otherButtonTitles:// how to pass those params here?];
}
如您所见,我还必须在UIAlertView 的init 方法中传递这些参数。我不确定如何将这些参数发送到otherButtonTitles。我可以通过以下方式调用这个方法。
ALERT(@"My Alert Title",@"Alert Subtitle",@"YES",viewCtr,@"No",@"May Be",@"Cancel",nil);
ALERT(@"Alert Title",@"Alert Subtitle",@"OK",viewCtr,@"Cancel",nil);
ALERT(@"Alert Title",@"Alert Subtitle",@"OK",viewCtr,nil);
ALERT(@"Alert Title",@"Alert Subtitle",@"OK",viewCtr,@"Option1",@"Option2",nil);
【问题讨论】:
标签: objective-c c function parameters arguments