• 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
Displaying NSArray in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Displaying NSArray in NSTableView


  • Subject: Displaying NSArray in NSTableView
  • From: 양승준 <email@hidden>
  • Date: Mon, 17 Nov 2008 21:03:10 +0900
  • Importance: normal

Hi, I'm trying to display data in an array to a table view. The table view shows three rows, but no data in them. What did I do wrong? In IB, I connected the table view to the delegate in File's owner. Many thanks!
Here is MyDocument.h:
#import Cocoa.h>
@interface MyDocument : NSDocument
{
 IBOutlet NSTableView *parTableView;
 NSArray     *parBuffer;
}
- (int)numberOfRowsInTableView:(NSTableView *)aTable;
- (id)tableView:(NSTableView *)aTable objectValueForColumn:(NSTableColumn *)aCol row:(int)aRow;
@end
And in MyDocument.m:
- (int) numberOfRowsInTableView:(NSTableView *)tableView
{
 return ([parBuffer count]);
}
- (id)tableView:(NSTableView *)aTable 
objectValueForColumn:(NSTableColumn *)aCol 
 row:(int)aRow
{
 return ([parBuffer objectAtIndex:aRow]);
}
The data is in parBuffer initialized inside (id) init as
 parBuffer =  [NSArray arrayWithObjects:
   [NSNumber numberWithInt:4],
   [NSNumber numberWithInt:8],
   [NSNumber numberWithFloat:3.14] , nil];

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

  • Follow-Ups:
    • Re: Displaying NSArray in NSTableView
      • From: Quincey Morris <email@hidden>
    • Re: Displaying NSArray in NSTableView
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: How to implement float min(float x, ...) ?
  • Next by Date: Question about interface builder
  • Previous by thread: CoreImage filters question
  • Next by thread: Re: Displaying NSArray in NSTableView
  • Index(es):
    • Date
    • Thread