• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Simple TableView App (problem)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
====================================================================


References: 
 >Simple TableView App (problem) (From: Thilo Ettelt <email@hidden>)

  • Prev by Date: NSDrawer open at startup
  • Next by Date: Finder refresh Application cache question.
  • Previous by thread: Re: Simple TableView App (problem)
  • Next by thread: Re: Simple TableView App (problem)
  • Index(es):
    • Date
    • Thread