Re: NSTableView searching and predicates
Re: NSTableView searching and predicates
- Subject: Re: NSTableView searching and predicates
- From: Andrew Farmer <email@hidden>
- Date: Sat, 4 Aug 2007 16:44:18 -0700
On 03 Aug 07, at 07:20, mmalc crawford wrote:
On Aug 3, 2007, at 6:49 AM, Daniel Wambold wrote:
-(void) myEventSearch:(id)sender
{
NSPredicate *myFilterPredicate;
NSString *mySearchString = [sender stringValue];
if (mySearchString != nil)
{
myFilterPredicate = [NSPredicate predicateWithFormat:
@"%@ IN[cd] myEvent || %@ IN[cd] myNotes", mySearchString,
mySearchString];
}
[self setFilterPredicate:myFilterPredicate];
[self rearrangeObjects];
}
That'll run [self setFilterPredicate:] on an uninitialized variable
if mySearchString is nil. The third line should probably be:
NSPredicate *myFilterPredicate = [NSPredicate predicateWithValue:YES];
in order to get identical behavior to the original.
_______________________________________________
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