Re: NSFormatter: get default values
Re: NSFormatter: get default values
- Subject: Re: NSFormatter: get default values
- From: Graham Cox <email@hidden>
- Date: Mon, 31 May 2010 10:46:35 +1000
I think the problem is that collection views make a copy of the 'prototype' view for each view they create. They do this using archiving/dearchiving, and they have no way to make connections of the sort you've made because they are application dependent.
Have a look and see if there is a hook you can use to manually remake the connection as each view instance comes into being.
Otherwise you could change your design a bit. For example, I have a class of formatter that scales its values according to a scaling factor set in each document. Each formatter instance picks up this common setting from a class variable in its own class, and as each document is activated and deactivated, it sets the appropriate class-level value. That way each formatter doesn't need to know about documents, only its own class. The only gotcha with this is that when the class setting changes it needs to tell the formatters to refresh, which is awkward as they are not views and do not have a connection to the view they're attached to. So I added a back-connection to the immediate textfield to deal with that - that connection should be OK as it's internal to the copied collection view instance.
--Graham
On 31/05/2010, at 9:45 AM, Rainer Standke wrote:
> Hello,
>
> I have a custom formatter that needs to to look up a default value based on the current document. The textfield the formatter sits on is part of a collection view. In the nib the formatter has a connection (via IBOutlet) to the object that holds the value that is to be looked up. The problem is that the formatter instances that belong to the collection view instances don't connect to anything.
>
> How can I get around this? I guess a solution could be either be in the formatter, where I have no idea what to do with it, or with the the message flow from the collectionviewitem to the document.
>
> Any help would be appreciated.
>
> Rainer
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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