On Mar 16, 2011, at 09:57, Georg Seifert wrote:

> If I have a master detail interface bound to a array controller.
> 
> To explain my problem (the actual structure is different but as an 
> explanation):
> The list shows a some persons. Then I have a switch that selects if the 
> detail view shows the private or the work address. Is there any easy way do 
> that. 
> 
> Now I use another array controller. On every selection change I make an array 
> of addresses and set as the content array.
> 
> Is there an easier solution?
> 
> Or can I change the keypath if the address switch changes?

You should be able to rebind the detail view table column according to the 
property you want it to display:

        [tableColumn bind: @"value" toObject: arrayController withKeyPath: 
@"address property name 1 or 2" options: ...];

Or, you could create one table column for each address, and reconfigure the 
table to show the appropriate column:

        [table addTableColumn: tableColumn1];
        [table removeTableColumn: tableColumn2];

Or, you could just hide/show columns:

        [tableColumn1 setHidden: NO];
        [tableColumn2 setHidden: YES];

Or, you could have two separate tables, and hide/show the appropriate table:

        [table1 setHidden: NO];
        [table2 setHidden: YES];

It's also possible to create a derived data model "address1OrAddress2" 
property, but this is only useful if the address mode doesn't need to be set in 
different ways for different views of the data.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to