On Oct 17, 2010, at 4:29 PM, Chris Share wrote:

> I'm new to Cocoa. I'm developing a simple application that contains two 
> TableViews. What I can't figure out is how to distinguish between the two 
> TableView pointers that are passed in to:
> 
> - (int)numberOfRowsInTableView:(NSTableView *) tableView
> - (id)tableView:(NSTableView *)tableView 
> objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
> 
> How do I do this?
> 
> In IB the Names and IDs of the two table views are different - do I somehow 
> need 
> to use these? If so, how?

There's a number of ways to do this....

Easiest is to match the incoming tableView to the IBOutlet from your XIB/NIB, 
e.g.:

- (int)numberOfRowsInTableView:(NSTableView *) tableView
{
        if( tableView == myFirstTable )
        {

        } 
        if( tableView == mySecondTable )
        {

        }
}

Tables don't have "names" per se.

Hope this helps,



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to