• 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
NSSearchField problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSSearchField problem


  • Subject: NSSearchField problem
  • From: Michael de Haan <email@hidden>
  • Date: Sat, 12 Oct 2013 17:14:41 -0700

Hi all
I am struggling to solve this problem.
I wish to implement a searchField similar to the "Find" of Xcode's IDE editor, where, for example, "Recent Results" places the item chose into the SearchField and performs the search with the chosen string. The current setup( in OSx)  is a simple TableView, an Array controller which populates the tableView with Managed Object instances, and works as expected. ( ie Add, Remove are implemented through the controller). 
I have implemented the direct search by creating a predicate with the inputString of the searchField and applying that to the arrayController, which works as expected. (done in the delegate ControlTextDidChange method);

The code I am using to try to implement the issue mentioned above is as follows. (unapologetically "modified" from Apple's searchField example)

-(void)setUpSearchField{


    if ([self.searchField respondsToSelector:@selector(setRecentSearches:)]) {

        


        

        NSMenu * searchMenu = [[NSMenu alloc]initWithTitle:@"Search Menu"];
        [searchMenu setAutoenablesItems:YES];

   

        

       

        NSMenuItem * recentSearchesItem = [[NSMenuItem alloc]initWithTitle:@"Recent Names"
                                                                    action:@selector(searchWithRecentNames:)
                                                             keyEquivalent:@""];
        [recentSearchesItem setTarget:self];
        [recentSearchesItem setTag:NSSearchFieldRecentsMenuItemTag];
        [searchMenu insertItem:recentSearchesItem atIndex:0];

       
        id searchCell = [self.searchField cell];
        [searchCell setSearchMenuTemplate:searchMenu];

        

       

       

       

    }

    

    

}

The selector is never called.
I have tried various delegate methods, but none are ever called.
A pointer in the right direction would be greatly appreciated.
Thanks in advance.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSSearchField problem
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: man pages
  • Next by Date: Re: man pages
  • Previous by thread: Re: Abandonware
  • Next by thread: Re: NSSearchField problem
  • Index(es):
    • Date
    • Thread