On Aug 9, 2012, at 10:47 AM, Ken Thomases <k...@codeweavers.com> wrote:

> Better would be to create a property on your controller which returns the 
> predicate, constructing it on demand for each call (perhaps with some smart 
> caching).  (I'll call the property "minMaxPredicate" for discussion.)  Bind 
> the array controller's filterPredicate binding to that property on your 
> controller.  Then, arrange for KVO change notifications to be emitted for the 
> property when the minimum and maximum value properties change.  The easiest 
> way to do this is to add a method like the following to your class:
> 
> + (NSSet *) keyPathsForValuesAffectingMinMaxPredicate
> {
>       return [NSSet setWithObjects:@"minimumValue", @"maximumValue", nil];
> }


Thanks Ken.  I implemented this all, but are having some trouble with the 
correct syntax for the predicate I'll use for this:

I added this to my Controller loadview method:

    self.minMaxPredicate = [NSPredicate predicateWithFormat:@"%f < value < %f", 
self.minValue, self.maxValue];

Where the float "value"  is a property of the entity that I am displaying in 
the table and self.minValue and self.maxValue are floats bound to my 
NSTextFields.

But no matter what I try, I get an error "Unable to parse the format string".  


Any suggestions?

- Koen.




_______________________________________________

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

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

Reply via email to