-Garry-

Apr 14, 2009, 12:25 AM

Hi, I know this is really basic but I've been working my way through several books I bought - starting off with basic Objective-C and then onto Cocoa and Interface Builder and I have a question on some syntax I don't think I've seen before. I was hoping somebody could explain it.

In an implementation file I understand you have to define the implementation of your own classes as follows:

-(void) print

{

NSLog (@”%i/%i”, numerator, denominator);

}

@end

The top line is the line I'm interested in. That's the syntax I've been using so far and I understand it.

I'm now seeing the following:

- (int)numberOfRowsInTableView:(NSTableView *)tv

{

return [voiceList count];

}

Again, the top line is the one I'm interested in. I understand it's saying that the method being defined (numberOfRowsInTableView) returns an integer. It's the second bit (NSTableView *)tv that I don't understand.

I believe it has something to do with passing arguments into the method but I don't understand the syntax. Can anyone explain?

In an implementation file I understand you have to define the implementation of your own classes as follows:

-(void) print

{

NSLog (@”%i/%i”, numerator, denominator);

}

@end

The top line is the line I'm interested in. That's the syntax I've been using so far and I understand it.

I'm now seeing the following:

- (int)numberOfRowsInTableView:(NSTableView *)tv

{

return [voiceList count];

}

Again, the top line is the one I'm interested in. I understand it's saying that the method being defined (numberOfRowsInTableView) returns an integer. It's the second bit (NSTableView *)tv that I don't understand.

I believe it has something to do with passing arguments into the method but I don't understand the syntax. Can anyone explain?