• 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: NSPredicateEditorRowTemplate for NSDate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPredicateEditorRowTemplate for NSDate


  • Subject: Re: NSPredicateEditorRowTemplate for NSDate
  • From: Markus Spoettl <email@hidden>
  • Date: Mon, 19 Jan 2009 22:24:32 +0100

On Jan 19, 2009, at 9:13 PM, Vitaly Ovchinnikov wrote:
Hey, boys and girls?
Am I the first, who use NSPredicateEditor?
I just found that there is no default template for time values...


I basically use this code for a date value row template (simplified version not tested):

NSArray *operators = [NSArray arrayWithObjects:
[NSNumber numberWithInteger:NSEqualToPredicateOperatorType],
[NSNumber numberWithInteger:NSLessThanPredicateOperatorType],
[NSNumber numberWithInteger:NSGreaterThanPredicateOperatorType],
[NSNumber numberWithInteger:NSLessThanOrEqualToPredicateOperatorType],
[NSNumber numberWithInteger:NSGreaterThanOrEqualToPredicateOperatorType],
nil];


NSExpression *equipmentExpr =
[NSExpression expressionForKeyPath:@"date"]; <<-- use the key path appropriate for your object


   NSPredicateEditorRowTemplate *dateTemplate =
       [[[NSPredicateEditorRowTemplate alloc]
           initWithLeftExpressions:expressions
      rightExpressionAttributeType:NSDateAttributeType
                          modifier:NSDirectPredicateModifier
                         operators:operators
                           options:0] autorelease];


NSArray *templates = [NSArray arrayWithObjects: ... dateTemplate, ... nil];


[editor setRowTemplates:templates]; <<-- editor is a NSPredicateEditor ivar


All is needed now is a predicate that matches the templates you defined and it should work. If you give the editor a predicate it cannot resolve using the row template you will get a console log entry telling you details (at least on Leopard).

Hope this helps!

Regards
Markus
--
__________________________________________
Markus Spoettl

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >NSPredicateEditorRowTemplate for NSDate (From: "Vitaly Ovchinnikov" <email@hidden>)
 >Re: NSPredicateEditorRowTemplate for NSDate (From: "Vitaly Ovchinnikov" <email@hidden>)

  • Prev by Date: Re: NSPredicateEditorRowTemplate for NSDate
  • Next by Date: Re: Binding of invisible controls: is lazy data loading possible?
  • Previous by thread: Re: NSPredicateEditorRowTemplate for NSDate
  • Next by thread: Re: NSPredicateEditorRowTemplate for NSDate
  • Index(es):
    • Date
    • Thread