• 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: Set up an editable view based NSTableView programmatically - how to?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set up an editable view based NSTableView programmatically - how to?


  • Subject: Re: Set up an editable view based NSTableView programmatically - how to?
  • From: Willeke <email@hidden>
  • Date: Wed, 08 Jan 2014 01:01:24 +0100

Op 7 jan 2014, om 16:52 heeft Peter het volgende geschreven:

> I’d actually prefer to use bindings, but my first column should simply display the row numbers

After some experimenting I managed to create a simple editable view based table view with row numbers, using bindings except for the row number. The row number is in a column with identifier "RowNumber". I implemented this delegate method:

- (NSView *)tableView:(NSTableView *)tableView
   viewForTableColumn:(NSTableColumn *)tableColumn
                  row:(NSInteger)row
{
	NSTableCellView *result = [tableView makeViewWithIdentifier:[tableColumn identifier] owner:self];
	if ([[tableColumn identifier] isEqualToString:@"RowNumber"])
		result.textField.objectValue = [NSNumber numberWithInteger:row];
	return result;
}

That's all.
This is the first time I used a view based table view and it looks too simple but maybe it helps.

Willeke
_______________________________________________

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: Set up an editable view based NSTableView programmatically - how to?
      • From: Peter <email@hidden>
References: 
 >Set up an editable view based NSTableView programmatically - how to? (From: Peter <email@hidden>)

  • Prev by Date: Re: Set up an editable view based NSTableView programmatically - how to?
  • Next by Date: Re: Set up an editable view based NSTableView programmatically - how to?
  • Previous by thread: Re: Set up an editable view based NSTableView programmatically - how to?
  • Next by thread: Re: Set up an editable view based NSTableView programmatically - how to?
  • Index(es):
    • Date
    • Thread