Re: filteredArrayUsingPredicate and points
Re: filteredArrayUsingPredicate and points
- Subject: Re: filteredArrayUsingPredicate and points
- From: Keary Suska <email@hidden>
- Date: Wed, 15 Apr 2009 10:02:40 -0600
On Apr 15, 2009, at 8:05 AM, Alexey Baev wrote:
I have class MyDot. This class has function:
- (BOOL) containsPoint: (NSPoint) pt;
I have also NSArray, which contains several MyDot objects:
NSArray* dots;
I want to get new array
NSArray* newDots
which contains MyDot objects and
for these dots containsPoint:(NSPoint)pt = YES.
How can I do that?
I would like to write something like that:
NSPoint checkedPoint = NSMakePoint(100, 100);
NSPredicate* predicate = [NSPredicate predicateWithFormat:
@"containsPoint %p == YES ", checkedPoint]; //i don't know what to
write here
NSArray* newDots = [dots filteredArrayUsingPredicate: predicate];
You can't. Just iterate over the array. After all, -
filteredArrayUsingPredicate: has to essentially do the same thing.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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