Method with multiple input parameters

后端 未结 6 1867
萌比男神i
萌比男神i 2021-02-01 02:11

I understand how to create my own methods that accept input parameters in objective-c but I have never actually created a method with more than one input parameter!

From

6条回答
  •  北海茫月
    2021-02-01 02:36

    Another option could be variadic parameters. They're used to provide a variable amount of parameters, even though you wouldn't have a name on each one of them. e.g.

    [NSString stringWithFormat:@"My name is %@ %@", @"John", @"Doe"];
    

    It would be something like this:

    - (void)names:(NSString *)names, ...;
    

    Implementation, additional info

提交回复
热议问题