Goal C: Cocoa: 2 sets of variable arguments?

You can have a method like this:

[obj mergeObjs:obj1,obj2,obj3,nil];

Or use the method as follows:

[obj mergeObjs:obj1,obj2...obj(n),nil usingBlocks:blk1,blk2,blk3....blk(m),nil];

where n may or may not be equal to m.

Basically several variable argument lists in a single method declaration.

This is not a potential answer:

[obj merge:[NSArray arrayWithObjects:[NSArray arrayWithObjects:...,nil],[NSArray arrayWithObjects:...,nil]...,nil]];

Thanks in advance.

Here is the link I found for argument lists with a single variable:

http://developer.apple.com/library/mac/#qa/qa1405/_index.html How to create variable argument methods in Objective-C

+3
source share
3 answers

. objc_msgSend() ( ). C, .

+4

, , ?

[obj mergeObjs:(NSArray*)objs usingBlocks:(NSArray*)blocks];

clang ( Objective C, Xcode) NSArray

[instance mergeObjs:@[obj1, obj2, obj3] usingBlocks:@[^{}, ...]];

(, , NSArray).

+5

, ​​ - 2 .

mulit-Variable-arguments - .

... !!.

0

All Articles