One method is as follows:
+ (Void) initWithArguments: (NSString *) title withMessage: (NSString *) message delegate: (id) sender buttonName: (NSString *) btnName buttonNames: (NSString *) other, ... {
UIAlertView * alter = [[UIAlertView alloc] initWithTitle: title
message: message
delegate: sender
cancelButtonTitle: btnName
otherButtonTitles: ( argument here is that write it write ?), nil];
[Alter show];
[Alter release];
}
==========
Daren want answered? ? ? For up people should be very simple
Reply:
You can write @ "anotherButton" or nil, it's just add another button to it, you can not write.
Reply:
Do not understand the meaning of my dear friend?
(NSString *) other, ... still do not understand how the combination here
Reply:
Daren Daren ~ ~ ~ ~ ~ ~
Reply:
Variable parameters, for example:
NSArray * answerArray = [NSArray arrayWithObjects: @ "1", @ "2", @ "3", nil] ;/ / this can be
NSArray * answerArray = [NSArray arrayWithObjects: @ "1", nil] ;/ / this can be
UIAlertView * alter = [[UIAlertView alloc] initWithTitle: title
message: message
delegate: sender
cancelButtonTitle: btnName
otherButtonTitles: (So here you can write one, you can write more than one, you can not write, of course, do not write the words you want to remove the comma in front of nil), nil];
[Alter show];
[Alter release];
}
Reply:
I mean, I wrote that the way to pass the NSString *) other, ... This parameter directly if I wrote
otherButtonTitles: other, nil / / then there is only one parameter
otherButtonTitles: other, ..., nil / / tried to write so be wrong
Reply:
Is a non-variable parameters, can not pass the variable parameters of the problem
Reply:
Reply:
otherButtonTitles: (Here's what the parameters of the write write?)
This thing is saying: Do they need a second or more buttons.
If necessary, enter @ "name" string
If not, please: nil
OK, it's that simple
Reply:
I think you have misunderstood what I mean, I give an example:
- (Void) alterShow (NSString *) other, ... {
UIAlertView * alter = [[UIAlertView alloc] initWithTitle: @ "prompt"
message: nil
delegate: nil
cancelButtonTitle: nil
otherButtonTitles: (here other, ... parameter how into @ "a", @ "b ", nil such wording)];
[Alter show];
[Alter release];
}
That is when you call [self alterShow: @ "aa", @ "bb", nil]; When
otherButtonTitles: (here other, ... parameter received how into @ "aa", @ "bb", nil such wording)
Reply:
I know. The uncertain parameters are C bar.
I know that it can be used:
va_list va_Average;
NSString * str;
va_start (va_Average, other) ;/ / va_start second argument is an argument
before ...while (other) {
str = va_arg (params, NSString *);
/ / Do something ... / / title we can go into an array.
else break;
}
va_end (va_Average);
Then, UIAlertView's - (NSInteger) addButtonWithTitle: (NSString *) title this method, in turn coupled to the good.
Reply:
Finally someone understands me, and burn incense to go ~ ~ ~
No comments:
Post a Comment