Re: Beginner problem with multiple NSTableView
Re: Beginner problem with multiple NSTableView
- Subject: Re: Beginner problem with multiple NSTableView
- From: Guy English <email@hidden>
- Date: Thu, 20 Jan 2005 19:07:45 -0500
Hi,
On Thu, 20 Jan 2005 18:50:07 -0500, James Housley <email@hidden>
This will work as long as you keep _numFeeds and _numItems updated.
Why don't you just return [_feedsList count] and [_numItems count] respectively?
> - (int)numberOfRowsInTableView:(NSTableView *)aView
> {
> if (aView = Feeds_Required_Files) {
> return _numFeeds;
> }
> else if (aView = Items_Required_Items) {
> return _numItems;
> } else {
> NSLog(@"numberOfRowsInTableView returning 0");
> return 0;
> }
> }
This code is correct except you're assigning in your if statement.
if ( aView = Feeds_Required_Files ) will always be true you need:
if ( aView == Feeds_Required_Files )
You do the same thing with the if ( aView = Items_Required_Items ) line.
Since you're using the valueForKey thing and you're getting your keys
directly from the table view column headers - make *sure* you spelt
them correctly in IB.
> - (id)tableView:(NSTableView *)aView
> objectValueForTableColumn:(NSTableColumn *)aCol row:(int)index
> {
> if (aView = Feeds_Required_Files) {
> NSString *key = [aCol identifier];
> return [[_feedlists objectAtIndex:index] valueForKey:key];
> }
> else if (aView = Items_Required_Items) {
> NSString *key = [aCol identifier];
> return [[_itemlists objectAtIndex:index] valueForKey:key];
> } else {
> NSLog(@"numberOfRowsInTableView returning nil");
> return nil;
> }
> }
> Would I need to add something like:
Uh ... no. :) Not really sure what that does. Except return
Feeds_Required_Files everytime it's called. Same "if" statement
problem in this code.
> - (id)datasource:(NSTableView *)aView
> {
> if (aView = Feeds_Required_Files) {
> return Feeds_Required_Files;
> else if (aView = Items_Required_Items) {
> return Items_Required_Files;
> } else {
> NSLog(@"datasource returning nil");
> return nil;
> }
> }
Hope the helps,
Guy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden