Every foo:(bar)baz
defines a parameter, for example
- (id)initWithTitle:(NSString *)title
message:(NSString *)message
delegate:(id)delegate
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSString *)otherButtonTitles, ... {
defines a method with five* parameters.
The stuff before the :
is part of the name of the method. In this example, the method's name is
initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:
The stuff between the (…)
is the type of that argument. Here, we see that the first argument must be an NSString*
.
Finally it's the name of the parameter.
(*: Sometimes there is sometimes a , ...
, like in here, indicating it's a variadic method.)
The method is called in the syntax
id result = [theAllocedAlertView initWithTitle:@"title"
message:@"message"
delegate:someDelegate
cancelButtonTitle:@"cancel button title"
otherButtonTitles:@"other", @"button", @"titles", nil];
So the name of the method is repeated (in order!), and the parameter names are substituted by the actual arguments.
In C#, the corresponding function signature would look like
object InitWithTitleAndMessageAndDelegateAndCancelButtonTitleAndOtherButtonTitles(
string title,
string message,
object delegate,
string cancelButtonTitle,
params string[] otherButtonTitles);
and called like
object result = theAllocedAlertView.InitWithBlahBlahBlahAndOtherButtonTitles(
"title",
"message",
someDelegate,
"cancel button title",
"other", "button", "titles");