Re: Solved! and new question Re: NSTableView - probably a stupid question
Re: Solved! and new question Re: NSTableView - probably a stupid question
- Subject: Re: Solved! and new question Re: NSTableView - probably a stupid question
- From: Greg Titus <email@hidden>
- Date: Sun, 2 Feb 2003 14:44:06 -0800
On Sunday, February 2, 2003, at 01:26 PM, Yuhui wrote:
I finally figured out what was wrong. The O'Reilly code uses
NSTableColumnView's identifier: method to match the data in the
dictionary against the cells in a table row. When I checked my
NSTableView in IB, I found that while I had put the correct phrase in
each column's Column Title field, I hadn't done the same for the
respective Identifier field.
To make things more confusing, when I typed in the phrase (the same
one in Column Title) in the Identifier field and pressed Enter, IB
would erase what I had just typed in. The workaround was to delete the
phrase in Column Title, type it into Identifier, then type that back
(or copy-paste) in Column Title. Now my table view works as expected.
I'm not sure if this is the correct way to do it. Shouldn't Column
Title be the same as Identifier for each column? There's no title: or
columnTitle: method in NSColumnView, so that seems to make Column
Title useless. Is this a bug or did I miss something?
Yes, this is the correct way to do it (except the workaround for the
bug in IB). The reason why the column title and the identifier are not
the same thing is because it allows you to localize your application in
other languages without having to change the code. The identifiers that
you refer to in the code stays the same, and only the column titles are
modified in localized nib files to be appropriate for the particular
language.
Also, see the documentation on NSTableColumn's -headerCell method. It
says that you can get and set the column title by sending -stringValue
and -setStringValue: to the header cell object.
Hope this helps,
- Greg
_______________________________________________
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.