Re: Calling a method on objects in an NSArray
Re: Calling a method on objects in an NSArray
- Subject: Re: Calling a method on objects in an NSArray
- From: Allan Odgaard <email@hidden>
- Date: Thu, 13 May 2004 20:01:02 +0200
On 13. May 2004, at 18:23, David Piasecki wrote:
Is it possible, as in some other languages, to call a method on all
objects in an array via one line of code (no loops)?
You can do:
[array makeObjectsPerformSelector:@selector(action)];
Or (to "collect" the results):
NSArray* res = [array valueForKey:@"action"];
_______________________________________________
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.