Re: Newbie: How to understand Xcode's documentation
Re: Newbie: How to understand Xcode's documentation
- Subject: Re: Newbie: How to understand Xcode's documentation
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 15 Jul 2008 16:33:49 -0600
On Jul 15, 2008, at 4:19 PM, Phil Faber wrote:
- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange
[...]
Can anyone explain how I can 'decode' the usage information shown in
the documentation into real code? Not just for this example, but in
general.
OK, let's do this one part at a time, from left to right:
1. The - means that the method is an instance method, not a class
method. That means you use it on an NSString instance you have
initialized somewhere else.
2. The (void) means the method doesn't return anything, so depending
on its return value makes no sense.
3. The "unichar *" means the first argument takes a unichar pointer.
You have to declare this pointer beforehand.
4. The "NSRange" means the second argument is an NSRange data
structure. You usually make these using the NSMakeRange() macro.
As others have said, I'd strongly recommend reading up first on the C
programming language, and then on ObjC. Then this stuff will make more
sense.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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