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

NSSearchField loses focus


  • Subject: NSSearchField loses focus
  • From: Peer Allan <email@hidden>
  • Date: Wed, 21 Jan 2004 11:18:51 -0600

Using a custom NSArrayController I am searching a table below is my searching code.

- (NSArray *)arrangeObjects:(NSArray *)objects {

if (searchString == nil) {
return objects;
}

NSMutableArray *filteredObjects = [NSMutableArray arrayWithCapacity:[objects count]];
NSEnumerator *objectsEnumerator = [objects objectEnumerator];
id item;

while (item = [objectsEnumerator nextObject]) {
if ([[item valueForKeyPath:@"name"] rangeOfString:searchString options:NSCaseInsensitiveSearch].location != NSNotFound) {
[filteredObjects addObject:item];
}
}

return [super arrangeObjects:filteredObjects];
}

This is almost straight out of Apple's docs.

The problem is that when I try to do a live search. The search field loses focus and interrupts my typing of the query when the Controller returns results from what I have entered up to that point (usually 2 or 3 character). Any ideas where I should look to solve this?

Peer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSSearchField loses focus
      • From: Justin Anderson <email@hidden>
  • Prev by Date: Re: Q: how do you generate get/set methods?
  • Next by Date: Re: Question about multi-processing, multi-threading...
  • Previous by thread: Re: Question about multi-processing, multi-threading...
  • Next by thread: Re: NSSearchField loses focus
  • Index(es):
    • Date
    • Thread