Re: Multiple NSTableView question
Re: Multiple NSTableView question
- Subject: Re: Multiple NSTableView question
- From: Phillip Mills <email@hidden>
- Date: Thu, 21 Jun 2001 09:24:36 -0400
On 6/20/01 10:31 PM, "Joe Schiwall" <email@hidden> wrote:
>
theTableView parameter is a pointer to one of the NSTableView Objects, so
>
you can just compare the pointers to see which object it points to, for
>
example:
>
>
- (int)numberOfRowsInTableView:(NSTableView *)theTableView
>
{
>
if (theTableView == myTableView1)
>
do something;
>
else if (theTableView == myTableView2)
>
do something else;
>
}
Being new to Obj-C and Cocoa....
This seems very non-OOP and I wonder whether it's a normal Obj-C idiom. (?)
I would have expected something like:
- (int)numberOfRowsInTableView:(NSTableView *)theTableView
{
[theTableView doSpecialStuff];
[self doCommonStuff];
}
But this, of course, requires extensions to NSTableView...sub-class,
category...? Using PowerPlant, I would have automatically considered
sub-classing (because it's really easy) if doSpecialStuff was at all
complex. Is polymorphism for UI classes abnormal here?