Don't understand multiple parameter declarations in objective-c

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-06-11T21:43:55Z Indexed on 2010/06/12 3:02 UTC
Read the original article Hit count: 210

Filed under:

can someone clarify this for me:

When there’s more than one argument, the arguments are declared within the method name after the colons. Arguments break the name apart in the declaration, just as in a message. For example:

- (void)setWidth:(float)width height:(float)height;

So in the above:

  1. method is for instance variables
  2. returns void
  3. parameter#1 is a float, named width.

  4. parameter#2 is a float,named height.

But why is it hieght:(float)height; and not just:

- (void)setWidth: (float)width (float)height;

© Stack Overflow or respective owner

Related posts about objective-c