Re: Sub classing.
Re: Sub classing.
- Subject: Re: Sub classing.
- From: Sandro Noel <email@hidden>
- Date: Tue, 5 Dec 2006 10:36:12 -0500
Marc
Nah, [super count] does the same thing.
but i am interested in any other way, please explain the "category"
term.
thank you!
Sandro Noel.
On 5-Dec-06, at 10:29 AM, Marc Respass wrote:
Sandro,
I'm not sure why [self count] is a problem but maybe [super count]
will work. NSMutableArray is a bit of a special class (a class
cluster) so you should read the docs for NSArray and the section on
subclassing.
You might want to do this as a category instead of a subclass. I
think that's a pretty common pattern. If you make a category and
add the datasource methods, you can use any mutable array and don't
have to worry about using your own.
Hope this help
Marc
On Dec 5, 2006, at 10:07 AM, Sandro Noel wrote:
Greetings.
Am I doing this wrong ?
i want to create a Dataset for a table view, it's a simple one an
the values should be static.
so i declare .
@interface StatusTableDataset : NSMutableArray {
}
- (id) init;
- (void) dealloc;
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)
rowIndex;
@end
----------------------
this works nicely at compile time, but
- (int)numberOfRowsInTableView:(NSTableView *)aTableView{
return [self count];
}
at runtime will tell me that "count" is only defined for abstract
classes,and that i have to declare my own,
2006-12-05 10:04:51.684 t[3211] An uncaught exception was raised
2006-12-05 10:04:51.684 t[3211] *** -count only defined for
abstract class. Define -[StatusTableDataset count]!
2006-12-05 10:04:51.684 t[3211] *** Uncaught exception:
<NSInvalidArgumentException> *** -count only defined for abstract
class. Define -[StatusTableDataset count]!
who should i inherit from to get all the nice functionality, and
not have to implement them myself ? :)
thank you!
Sandro Noel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40mac.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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