ボタンを押すと特定のオブジェクトが渡されるように、プログラムでボタンを追加しようとしています。「認識されないセレクターが送信されました」という例外が引き続き発生します。コードの問題点を教えてください:
// allocate the details button's action
SEL selector = @selector(showPropertyDetails:forProperty:);
NSMethodSignature *signature = [[self class] instanceMethodSignatureForSelector:selector];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
[invocation setSelector:selector];
//The invocation object must retain its arguments
[property retain];
//Set the arguments
[invocation setTarget:self];
[invocation setArgument:&property atIndex:3];
[(UIButton*)[myView viewWithTag:15] addTarget:self action:@selector(selector) forControlEvents:UIControlEventTouchDown];
さらに、同じクラスのメソッドは次のようになります。
-(void) showPropertyDetails:(id)something forProperty:(Property *)property {
int i=0;
}