• 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: Programmatic access to NSSearchField's Display Name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatic access to NSSearchField's Display Name?


  • Subject: Re: Programmatic access to NSSearchField's Display Name?
  • From: "email@hidden" <email@hidden>
  • Date: Thu, 7 May 2009 08:13:51 +0100


On 6 May 2009, at 22:43, email@hidden wrote:

Namaste!

Is there a way to programmatically access the Display Name attribute of the search field for a given predicate?

I've got a number of predicates set up via IB and several of them I need to be able to change the display name at run time.


If you create your searchField bindings manually rather than in IB then you can recreate them as and when you require with specific display names:


NSString *search1 = @"(unitName CONTAINS[cd] $value OR unitPluralName CONTAINS[cd] $value)";
NSString *search2 = @"(messageStringValue CONTAINS[cd] $value)";


// search all
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedString(@"All", @"Search field placeholder"), NSDisplayNameBindingOption,
search1, NSPredicateFormatBindingOption,
nil];
[self.searchField bind:NSPredicateBinding
toObject:entryController
withKeyPath:@"filterPredicate"
options: options];


Note that searchField exposes additional bindings every time you bind a predicate. so the next binding requires a suffix to NSPredicateBinding.

// search entry
options = [NSDictionary dictionaryWithObjectsAndKeys:
NSLocalizedString(@"Entry", @"Search field placeholder"), NSDisplayNameBindingOption,
search2, NSPredicateFormatBindingOption,
nil];

[self.searchField bind:[NSPredicateBinding stringByAppendingString:@"2"]
toObject:entryController
withKeyPath:@"filterPredicate"
options: options];


Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

_______________________________________________

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

Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




_______________________________________________

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


  • Follow-Ups:
    • RE: Programmatic access to NSSearchField's Display Name?
      • From: "Jon C. Munson II" <email@hidden>
References: 
 >Programmatic access to NSSearchField's Display Name? (From: email@hidden)

  • Prev by Date: Re: NSXMLParser frees itself on error?
  • Next by Date: Re: NSXMLParser frees itself on error?
  • Previous by thread: Programmatic access to NSSearchField's Display Name?
  • Next by thread: RE: Programmatic access to NSSearchField's Display Name?
  • Index(es):
    • Date
    • Thread