First parameter name in objective c?

Tom picture Tom · Jan 7, 2012 · Viewed 8.9k times · Source

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?

Answer

Carl Norum picture Carl Norum · Jan 7, 2012

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];