Re: How to Distinguish Between Two TableViews
Re: How to Distinguish Between Two TableViews
- Subject: Re: How to Distinguish Between Two TableViews
- From: Michael Dautermann <email@hidden>
- Date: Mon, 18 Oct 2010 13:27:17 -0700
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@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