• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ObjC Question - labeled arguments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC Question - labeled arguments


  • Subject: Re: ObjC Question - labeled arguments
  • From: mmalc crawford <email@hidden>
  • Date: Wed, 21 May 2008 22:15:56 -0700


On May 21, 2008, at 9:48 PM, Peter Zegelin wrote:

So my question is - is there a way to include the first label? I note that the examples in the ObjectiveC manual seem to leave the first one out also:
[myRect setWidth:10.0 :15.0]; ---> [myRect setWidth:10.0 height: 15.0];


No, it doesn't.


[myRect setOrigin:30.0 :50.0];
Here the method name, setOrigin::, has two colons, one for each of its arguments. The arguments are inserted after the colons. This method name uses unlabeled arguments. Unlabeled arguments make it difficult to determine the kind and purpose of a method’s arguments. Instead, method names should include labels describing each of their arguments. Argument labels precede each colon in the method name. The setWidth:height: method, for example, makes the purpose of its two arguments clear:


[myRect setWidth:10.0 height:15.0];

<http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html >

mmalc

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ObjC Question - labeled arguments
      • From: Peter Zegelin <email@hidden>
References: 
 >ObjC Question - labeled arguments (From: Peter Zegelin <email@hidden>)

  • Prev by Date: Re: creating a resource fork and writing raw bytes to it
  • Next by Date: Re: fundamental question: how do I call controller methods from other classes?
  • Previous by thread: Re: ObjC Question - labeled arguments
  • Next by thread: Re: ObjC Question - labeled arguments
  • Index(es):
    • Date
    • Thread