私は、objective-cメソッドは実際にはc関数であり、最初の2つの引数はselfと_cmdであることを知っています。私は、例えば、(含むまたは除く、自己および_cmd)配列として残りの引数を取得するためにobjective-cメソッドの引数をインデックスで取得する
をしようとしている:
[self doOtherMethod:@selector(otherMethod:withObject:andObject:) withObjects:args];
:
-(void)someMethod:(id)firstArg withObject:(id)secondArg andObject:(id)thirdArg {
//then something like:
args[0] //corresponds to self
args[1] //corresponds to _cmd
args[2] //corresponds to firstArg
args[3] //corresponds to secondArg
args[3] //corresponds to thirdArg
//or just start from firstArg being the 0th item in the index (skipping out self and _cmd)
}
を私は何をしようとしているようなものです
どのように私はそれらを渡すか、それらを列挙できるように、メソッドに渡される引数の配列(c配列またはNSArray)を取得できますか?
編集:私は既存の方法でこれをやりたいです。私が変更できないデリゲートメソッド。
たぶん、あなたはにObjCブロックでそれを行うことができますが。 – 3lvis
これは実際には非常に困難な問題です。 –
@DaveDeLong、もしあなたが私のためにそれが不可能ではないと言っているのなら、 –