• 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: Please help! Dynamically changing the NSTableView header ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please help! Dynamically changing the NSTableView header ?


  • Subject: Re: Please help! Dynamically changing the NSTableView header ?
  • From: "chris corbell"<email@hidden>
  • Date: Fri, 13 Sep 2002 15:33:26 -0700

Philipp Seibel wrote:
>Hi everybody,
>
>i'd like to load a csv file into a NSTableView, >but i couldn't fill the
tableheader with the >strings in the first line of the csv file.
>Does anybody know how to get along with this.
>
>thx
>
>Phil

I believe you just need to get the column
whose header you wish to change and set the
title of its header cell. This worked for
me - the code below is for adding a new column
but it should also work if you just get the
existing NSColumn. This is an instance method
of a data source class; m_records is an
NSArray.

Hope this helps,
Chris


- (void)AddColumn:(NSString *)sColumnIdentifier values:(NSArray *)valueArray
withTitle:(NSString *)sColumnTitle
{
NSTableColumn * pColumn = nil;
int nIndex, nCount;
nCount = [valueArray count];
NSParameterAssert(nCount == [m_records count]);
if(nCount > [m_records count])
nCount = [m_records count];

for(nIndex = 0; nIndex < nCount; nIndex++)
{
[self SetValueForRecord:[self GetRecordForIndex:nIndex]
withKey:sColumnIdentifier value:[valueArray objectAtIndex:nIndex]];
}

pColumn = [[NSTableColumn alloc] initWithIdentifier:sColumnIdentifier];
[[pColumn headerCell] setStringValue:sColumnTitle];
[m_tableView addTableColumn:pColumn];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Inter-Application Communication in Cocoa ?
  • Next by Date: Bilingual shenanigans
  • Previous by thread: Please help! Dynamically changing the NSTableView header ?
  • Next by thread: Re: mail.app plug-in API's (We need MAPI-like functionality)
  • Index(es):
    • Date
    • Thread