I have a method:
- (void)pan:(double)lat longitude: (double) lon{...}
When I call it Xcode shows to like this:
[self pan:(double) longitude:(double)]
Isn't it possible to set first parameter somehow, like the second (longitude)
, that Xcode could show like this:
[self pan: latitude:(double) longitude:(double)]
It is very annoying for me that I can not see the name of the first parameter when calling. Is it my fault or it is impossible?
The argument label is used when calling the function; each argument is written in the function call with its argument label before it. The parameter name is used in the implementation of the function. By default, parameters use their parameter name as their argument label.
Correct, objective-C does not support method overloading, so you have to use different method names.
To omit argument labels, use a _ before the parameter name. A parameter name is still necessary to access the argument's value inside the function. Omitting the argument label might be wanted to make the function more readable.
The normal way to do what you're asking is to declare your method like:
-(void)panLatitude:(double)lat longitude:(double)lon;
That is, include the label for the first argument with the method name at the beginning. You'd use it like:
[self panLatitude:x longitude:y];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With