Re: Simple TableView App (problem)
Re: Simple TableView App (problem)
- Subject: Re: Simple TableView App (problem)
- From: Serge Meynard <email@hidden>
- Date: Sun, 03 Feb 2002 13:28:44 -0500
on 2/3/02 1:07 PM, Thilo Ettelt at email@hidden wrote:
>
Hi folks!
>
>
I'm experimenting with the TableView. The concept of a view and an
>
object is pretty complicated for me, but I want to get it work. So I
>
wrote a little app with a tableview, a textfield and a button, I
>
connected everything properly in the IB. The PB shows up no errors when
>
compiling, but the function, that should be provided by the app doesn't
>
work. It should simply add a row to the tableview...
>
>
Can anybody help me?
>
>
>
Cheers, Thilo
>
>
--
>
>
- (IBAction)addValue:(id)sender
>
{
>
[myArray addObject:[valueText stringValue]];
>
[myTableView reloadData];
>
}
>
>
- (id)tableView:(NSTableView *)aTableView
>
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
>
{
>
return [[myArray objectAtIndex:rowIndex] objectForKey:[aTableColumn
>
identifier]];
>
}
You are inserting strings in your array, not objects with fields and
accessors. You should simply use:
return [myArray objectAtIndex:rowIndex];
If you were accessing multi-field objects, you would use:
return [[myArray objectAtIndex:rowIndex] valueForKey: [aTableColumn
identifier]];
Serge
====================================================================
Light travels faster than sound.
This is why some people appear bright until you hear them speak.
====================================================================